By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,853 Members | 2,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,853 IT Pros & Developers. It's quick & easy.

Pop up window problem with dynamic textboxes and query string

P: n/a
Dear All,
What i need to achieve is :
I am generating dynamic text boxes thru dhtml coding, i need onChange
event of oragnistation text box i.e dynamically generated on click of
"More" button in myhtml page
in series manner like oragnisation0,oragnisation1,oragnisation2 and so
on,
and popup window will open onChange event of (oraganisation<iCount>)
with one query string / parameter i.e value of oraganisation so that i
will use that parameter as searching crieterion in pop window form, and
that will show data corresponding to that value. Further user can click
on any value displayed in popup windows finally all values in popup
window will now set in parent form like oraganisation name, area, city
etc so basically i need search form will open in pop up window with 1
paramater and display record accordingly. I have achived this thing in
static form and static textbox onChange event, but when i put the
onChange even with " ?id= " in below code as
onChange='javascript: openWin(contact_list.php"+(str)+iCount+".value)'
where (str) = ?id=

var strTemp = "id=organisation";
str = "?" + strTemp;

i will get an error expected ":" on line number....
So i only want that somehow i'll be able to open popup window with
querystring as
openWin(contact_list.php?id=organisation<(iCount)> .value)

The error will not come if i'll remove "?" from the code.

Thanks for Help in advance
Below is actual code in which I'm getting error :
<script>
var strTemp = "id=organisation";
str = "?" + strTemp;

cust1.innerHTML +="<table width=100% border=0 cellpadding=0
cellspacing=0><tr><td><table width=100% border=0 cellspacing=0
cellpadding=4><tr><td width=10%><strong>Title</strong></td><td
width=11%><strong>First Name </strong></td><td width=11%><strong>Last
Name </strong></td><td width=14%><strong>Designation</strong></td><td
width=20% ><strong>Organisation</strong></td><td width=20%
<strong>Area</strong></td><td width=41% class=name>&nbsp;</td></tr><tr><td><label><select name=title" +iCount+" id=title" +iCount+ "><option value=Mr. selected=selected>Mr.</option><option value=Ms.>Ms.</option></select></label></td><td><input name=first_name" +iCount+ " type=text id=first_name" +iCount+ " size=10/></td><td><input name=last_name" +iCount+ " type=text id=last_name" +iCount+ " size=10/></td><td><input name=designation" +iCount+ " type=text id=designation" +iCount+ " size=15/></td><td><input name=organisation" +iCount+ " type=text id=organisation" +iCount+ " size=15 onChange='javascript: openWin(contact_list.php"+(str)+iCount+".value)'/></td><td><input name=area" +iCount+ " type=text id=area" +iCount+ " size=15/></td><td>&nbsp;</td></tr></table></td></tr><tr><td><table width=100% border=0 cellspacing=0 cellpadding=4><tr><td width=90><strong>City</strong></td><td width=90><strong>Mobile</strong></td><td width=91><strong>Landline</strong></td><td width=91><strong>Email</strong></td><td><strong>Helpful to PT ?</strong></td><td><strong>Rating</strong></td></tr><tr><td><span class=name><input name=city" +iCount+" type=text id=city" +iCount+" value='' size=15/></span></td><td><span class=name><input name=mobile" +iCount+" type=text id=mobile" +iCount+" value='' size=15 /></span></td><td><span class=name><input name=landline" +iCount+" type=text id=landline" +iCount+" value='' size=15/></td><td><span class=name><input name=email" +iCount+" type=text id=email" +iCount+" value='' onblur='javascript:return echeck(document.frm.email" +iCount+".value)' size=15/></span></td><td><label><select name=helpful" +iCount+" id=helpful" +iCount+"><option value=Yes>Yes</option><option value=No>No</option></select></label></td><td><select name=rating" +iCount+" id=rating" +iCount+"><option value=1>1</option><option value=2>2</option><option value=3>3</option><option value=4>4</option><option value=5>5</option><option value=6>6</option><option value=7>7</option><option value=8>8</option><option value=9>9</option><option value=10>10</option></select></td></tr><tr><td colspan=6><hr /></td></tr><tr><td colspan=6></td></tr></table></td></tr></table>";


</script>

Jan 30 '06 #1
Share this Question
Share on Google+
15 Replies


P: n/a
Kapil Jain wrote:
[...] I have achived this thing in static form and static textbox onChange
event, but when i put the onChange even with " ?id= " in below code as
onChange='javascript: openWin(contact_list.php"+(str)+iCount+".value)' ^[1]
Remove the `javascript:', then declare the default scripting language by

<meta http-equiv="Content-Script-Type" content="text/javascript">

in the `head' element.

See also <URL:http://jibbering.com/faq/#FAQ4_24>.
where (str) = ?id=

var strTemp = "id=organisation";
str = "?" + strTemp;

i will get an error expected ":" on line number....
So i only want that somehow i'll be able to open popup window with
querystring as
openWin(contact_list.php?id=organisation<(iCount)> .value) ^ The error will not come if i'll remove "?" from the code.
[^1] `contact_list.php' is considered a property access (with `contact_list'
as base object and `php' as the name of its property) unless you _enclose_
it in double quotes on _both_ sides. The following double quote (") is a
syntax error because the operator is then missing. Continuing to parse in
your favor anyway, the script engine encounters a `?' outside of a literal
and assumes the trinary conditional operator (?:); this operator requires a
`:' to delimit the expression for the true-case from the expression for the
false-case of the first operand. You do not provide it, hence the syntax
error displayed. However, you see that the real error occurred before.

You are correct that the second error does not occur if you omit the `?',
however the initial one remains.
Thanks for Help in advance
You are welcome, but please RTFFAQ and RTFM next time.

See also

<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>
<URL:http://www.safalra.com/special/googlegroupsreply/>

before you reply to my posting.
Below is actual code in which I'm getting error :
<script>
Should be

<script type="text/javascript">

See <URL:http://validator.w3.org/>.
var strTemp = "id=organisation";
str = "?" + strTemp;

cust1.innerHTML +="<table width=100% border=0 cellpadding=0 [1]^^^^^^^^^ ^^[2] ^^^^[3]

[1] Consider using W3C DOM methods to build the element subtree instead.

[2] This operator should be avoided for string concatenation.

[3] Attribute values containing e.g. the `%' character must be
enclosed in single (') or double (") quotes. It is best
to enclose all attribute values in quotes always.

<URL:http://www.w3.org/TR/html4/intro/sgmltut.html#idx-attribute-6>
cellspacing=0><tr><td><table width=100% border=0 cellspacing=0
ISTM that you are misusing tables for layout, a practice deprecated long
since. The outer table does not seem necessary; omit it and use CSS to
format the (borders and margins of the only real) inner table instead.
cellpadding=4><tr><td width=10%><strong>Title</strong></td><td ^^^^^^^^^^^^^^^^^^^^^^
You are misusing the `strong' element for achieving bold text. This element
is to mark up content to be _important_, so that a visual user agent can
emphasize it by displaying it e.g. bold or italic and e.g. a screenreader
application can raise voice on these occasions. Use the `b' (b for bold)
element instead or, even better, omit the tags for the `strong' element,
change `td' (table data, which it is not) into `th' (table header, which it
is) and use CSS to format it accordingly (text-align:left;
font-weight:bold).
[...]
id=designation" +iCount+ " size=15/></td><td><input name=organisation"
+iCount+ " type=text id=organisation" +iCount+ " size=15
onChange='javascript:
openWin(contact_list.php"+(str)+iCount+".value )'/></td><td><input
It is definitely unnerving for or even bothering to your users to have a
window or browser tab(!) pop up every time they change the value of this
input control. I strongly recommend using another approach, for example
a button they have to click in order to achieve the same.
[...]
class=name><input name=email" +iCount+" type=text id=email" +iCount+"
value='' onblur='javascript:return echeck(document.frm.email" [1]^^^^^^^^^^^ ^^^^^^[2]
[1] Same here.

[2] If you want to validate form data, you better do this when the form is
about to be submitted (in the `onsubmit' event handler attribute value
of the `form' element.
[...] </td></tr></table></td></tr></table>";


</script>


The `script' element's content is CDATA (Character DATA) in HTML. You have
to escape all EndTAGOpen delimiters (ETAGO: "</"). The markup parser is
likely to consider the element's content prematurely otherwise which will
result in incomplete and therefore syntactically incorrect script code for
the script engine. For example, the above line should be

[...] <\/td><\/tr><\/table><\/td><\/tr><\/table>";

You can workaround this issue if you place the script code in an external
script file and use the `script' element's `src' attribute to refer to it.
This will work in all HTML 4 user agents.
HTH

PointedEars

P.S.
You have posted the same four(!) times. NetNews is not a real-time
communication medium, you have to wait for your articles to appear.
Use <URL:http://services.google.com:8882/urlconsole/controller> to
remove the duplicates.
Jan 30 '06 #2

P: n/a
Thomas 'PointedEars' Lahn wrote:
Kapil Jain wrote:
[...] </td></tr></table></td></tr></table>";

</script>
The `script' element's content is CDATA (Character DATA) in HTML. You
have to escape all EndTAGOpen delimiters (ETAGO: "</"). The markup parser
is likely to consider the element's content prematurely otherwise

^^^^^^^^^^^^
_to end_ prematurely
which will result in incomplete and therefore syntactically incorrect
script code for the script engine. [...]

PointedEars
Jan 30 '06 #3

P: n/a
Dear Sir,

Thanks a lot for making me understand complex issues which i really not
ever heard.

Thanks for great help.

I will be greatful if you give me correct piece of code because i did
not understand the exact steps which i need to follow i understand a
little so please help me this time also.

Regards,
Kapil.

Jan 31 '06 #4

P: n/a
Kapil Jain wrote:
Dear Sir,

Thanks a lot for making me understand complex issues which i really not
ever heard.

Thanks for great help.
You are welcome.
I will be greatful if you give me correct piece of code because i did
not understand the exact steps which i need to follow i understand a
little so please help me this time also.


Which parts of my posting did you not understand? Do not say "all"; you
are free to learn and my time is precious, too.
PointedEars
Jan 31 '06 #5

P: n/a
Sir,

Please brief me the steps from scratch like first i understand to put
meta tag that is clear
second i did not understand what and how to declare
[1]^^^^^^^^^ ^^[2] ^^^^[3] and what do u mean by that simply
i wanna that what steps i'll use to rectify above code and how can i
use trinary operator "?" as a string or character.

Thanks

Jan 31 '06 #6

P: n/a
Kapil Jain wrote:
Sir,

Please brief me the steps from scratch like first i understand to put
meta tag that is clear
It is a `meta' _element_, <meta> is its start tag.
second i did not understand what and how to declare
[1]^^^^^^^^^ ^^[2] ^^^^[3]
_Declare_?
and what do u mean by that simply
I meant what I said. If you did not understand a specific term, you may ask
about it specifically if your favorite search engine does not provide for
results viable to you.
i wanna that what steps i'll use to rectify above code
There is no code above.
and how can i use trinary operator "?" as a string or character.


You are not making much sense, if any. Maybe it would be helpful if you
posted a sequence of sentences, like you did before.

Especially, you do _not_ want to use the trinary conditional operator, this
is just main reason why your code failed; you want to avoid it in the first
place by delimiting your string literals properly.

Please learn to read and to post properly. I have given you enough pointers
already. Sorry, I consider it a waste of my time to continue discussion in
this manner.
PointedEars
Jan 31 '06 #7

P: n/a
Dear Sir,

Sorry to disturb you if u find it waste of time. I'll not disturb u
again.
But please remember everybody is not having lots and lots of grasping
power like u have.
Anyway thanks to reply in any sense.

I'll get back to u again when i'll completely learn how to read and
post.

Thanks,
KJ.
Sr. Software Engg.
PTETSL, India.
Thomas 'PointedEars' Lahn wrote:
Kapil Jain wrote:
Sir,

Please brief me the steps from scratch like first i understand to put
meta tag that is clear


It is a `meta' _element_, <meta> is its start tag.
second i did not understand what and how to declare
[1]^^^^^^^^^ ^^[2] ^^^^[3]


_Declare_?
and what do u mean by that simply


I meant what I said. If you did not understand a specific term, you may ask
about it specifically if your favorite search engine does not provide for
results viable to you.
i wanna that what steps i'll use to rectify above code


There is no code above.
and how can i use trinary operator "?" as a string or character.


You are not making much sense, if any. Maybe it would be helpful if you
posted a sequence of sentences, like you did before.

Especially, you do _not_ want to use the trinary conditional operator, this
is just main reason why your code failed; you want to avoid it in the first
place by delimiting your string literals properly.

Please learn to read and to post properly. I have given you enough pointers
already. Sorry, I consider it a waste of my time to continue discussion in
this manner.
PointedEars


Feb 1 '06 #8

P: n/a
JRS: In article <85****************@PointedEars.de>, dated Tue, 31 Jan
2006 12:10:23 remote, seen in news:comp.lang.javascript, Thomas
'PointedEars' Lahn <Po*********@web.de> posted :

Which parts of my posting did you not understand? Do not say "all"; you
are free to learn and my time is precious, too.


Then don't waste your time, and that of everyone else, on bullying.
When you have nothing useful to day, it is better to say nothing than to
prove that you have nothing useful to say.

You could use the time that you this save in learning how to adjust your
writing style to be pleasant and comprehensible.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links;
Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Feb 1 '06 #9

P: n/a
JRS: In article <11*********************@g47g2000cwa.googlegroups. com>,
dated Wed, 1 Feb 2006 06:16:38 remote, seen in
news:comp.lang.javascript, Kapil Jain <ka*************@gmail.com> posted
:
Dear Sir,
"Dear Sir" is only appropriate when addressing superiors, or in very
formal correspondence. It is not appropriate here.
Sorry to disturb you if u find it waste of time. I'll not disturb u
again.
The preferred language here is English, though another well-known
languages are acceptable. Juvenile writing, such as "u", is despised.
But please remember everybody is not having lots and lots of grasping
power like u have.
Anyway thanks to reply in any sense.

I'll get back to u again when i'll completely learn how to read and
post.


The Hun has demonstrated his "superiority" by not explaining in plain
English what he, in this case rightly, wants.

You should, before posting to a newsgroup, seek its FAQ; and, if it has
one, read it. Ours is at <URL:http://www.jibbering.com/faq/>, and is
also posted here each week. Note Section 2.3.

If you find that, when you start a News reply, Google does not provide
the previous article in quoted form, note what Keith Thompson wrote in
comp.lang.c, message ID <ln************@nuthaus.mib.org> :-
If you want to post a followup via groups.google.com, don't use
the "Reply" link at the bottom of the article. Click on "show
options" at the top of the article, then click on the "Reply" at
the bottom of the article headers.

Newsgroups have a long history, but it seems that Google would prefer
you to be ignorant of that and believe that they are responsible for
more than just providing an inadequate interface to them.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Feb 1 '06 #10

P: n/a
On 2006-01-30, Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
Kapil Jain wrote:

cust1.innerHTML +="<table width=100% border=0 cellpadding=0 [1]^^^^^^^^^ ^^[2] ^^^^[3]

[2] This operator should be avoided for string concatenation.


why?

--

Bye.
Jasen
Feb 5 '06 #11

P: n/a
Jasen Betts wrote:
On 2006-01-30, Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
Kapil Jain wrote:
cust1.innerHTML +="<table width=100% border=0 cellpadding=0

[1]^^^^^^^^^ ^^[2] ^^^^[3]
[2] This operator should be avoided for string concatenation.


why?


Because it is highly inefficient compared to other approaches.
PointedEars
Feb 5 '06 #12

P: n/a
On 2006-02-05, Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
Jasen Betts wrote:
On 2006-01-30, Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
Kapil Jain wrote:
cust1.innerHTML +="<table width=100% border=0 cellpadding=0
[1]^^^^^^^^^ ^^[2] ^^^^[3]
[2] This operator should be avoided for string concatenation.


why?


Because it is highly inefficient compared to other approaches.


what's a better way to apppend a string?

Bye.
Jasen
Feb 5 '06 #13

P: n/a
JRS: In article <14****************@PointedEars.de>, dated Sun, 5 Feb
2006 16:06:28 remote, seen in news:comp.lang.javascript, Thomas
'PointedEars' Lahn <Po*********@web.de> posted :
Jasen Betts wrote:
On 2006-01-30, Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
Kapil Jain wrote:
cust1.innerHTML +="<table width=100% border=0 cellpadding=0
[1]^^^^^^^^^ ^^[2] ^^^^[3]
[2] This operator should be avoided for string concatenation.


why?


Because it is highly inefficient compared to other approaches.


In javascript, efficiency in execution is commonly unimportant in
comparison with efficiency of reading or writing. If a page renders in
less than 100 ms on a 300 MHz machine, there can be negligible benefit
in making one part of the code faster. Reduction in code size, however,
can be of benefit.

--
John Stockton, Surrey, UK. ??*@merlyn.demon.co.uk Turnpike v4.00 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Check boilerplate spelling -- error is a public sign of incompetence.
Never fully trust an article from a poster who gives no full real name.
Feb 5 '06 #14

P: n/a
Dr John Stockton wrote:
[...] Thomas 'PointedEars' Lahn [...] posted :
Jasen Betts wrote:
On 2006-01-30, Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
Kapil Jain wrote:
> cust1.innerHTML +="<table width=100% border=0 cellpadding=0
[1]^^^^^^^^^ ^^[2] ^^^^[3]
[2] This operator should be avoided for string concatenation.
why? Because it is highly inefficient compared to other approaches.


In javascript, efficiency in execution is commonly unimportant in
comparison with efficiency of reading or writing.


It is not.
If a page renders in less than 100 ms on a 300 MHz machine, there can be
negligible benefit in making one part of the code faster.
That depends on the context an algorithm runs in. And speed is only one
aspect of efficient programming.
Reduction in code size, however, can be of benefit.


True. One has to find a reasonable equilibrium between code size and code
efficiency.
PointedEars
Feb 6 '06 #15

P: n/a
Jasen Betts wrote:
On 2006-02-05, Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
Jasen Betts wrote:
On 2006-01-30, Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
Kapil Jain wrote:
> cust1.innerHTML +="<table width=100% border=0 cellpadding=0
[1]^^^^^^^^^ ^^[2] ^^^^[3]
[2] This operator should be avoided for string concatenation.
why?

Because it is highly inefficient compared to other approaches.


what's a better way to apppend a string?


That depends.

If only one value is to be appended, the above certainly is the best way.
It is not the best way if this it is used more than one time for the same
target. That is why I wrote that this operator should be avoided for
string concatenation, and not that it should not be used at all.
PointedEars
Feb 6 '06 #16

This discussion thread is closed

Replies have been disabled for this discussion.