PDA

View Full Version : how do I mark a field name with "|" in it?


bruce markham
09-12-2003, 02:40 PM
I am using the following code:
opener.document.form.test.value=document.form.fieldname.value; to transfer the field info in a pop-up back to the field in the original form.

My question is:
the value of my original form field is not "test", but "test|a|1"

I get the javascript error that "test" is not defined, probably because of the "|"'s after "test", but that is the actual field name.

Is there a way that I can allow this field name to work? (ie: maybe surrounding it with something like '' or []?

Thanks in advance for your help.

Roy Sinclair
09-12-2003, 03:22 PM
You're on the right track, the [] are exactly what you need. Try:

opener.document.form.elements["test|a|1"].value=document.form.fieldname.value;

bruce markham
09-13-2003, 10:26 PM
Thanks for your quick reply + information, Roy.

I posted this first question yesterday, thinking that it might take me a week or more to get an answer, if ever. Man, was I wrong :)