Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to add text to textbox named '.Send' - Can this be done?

Status
Not open for further replies.

rico7474

MIS
Oct 29, 2001
9
CA
Hello All,

I have a HTML page I need to add check boxes to that when checked will add the appropriate text to a textbox. The problem is the name of the textbox starts with a period (eg: .Send). Is this possible? Is there a way I can escape the name like:

window.document.form.\.Send.value="some text";

Or can I rename the textbox through javascript when the checkbox is clicked, add the appropriate text, then change the name back?

Any help is much appreciated.
Scott.
 
Check this snippet


<html>
<body onLoad=&quot;document.forms[0].elements['.Send'].value='New text'&quot;>
<form>
<input type=&quot;text&quot; name=&quot;.Send&quot; value=&quot;Initial text&quot;>
</form>
</body>
</html>
 
Thanks dianal but it did not work.
Here's the error message:

window.document.frmPolRequest.elements..Send
has no properties.

I think it is still expecting a new object after the first period.

Any other suggestions?
Thanks.
 
Thanks for your response xutopia.

I am assuming then that because the name token begins with the period, the textbox value is locked from any javascript. I cannot alter the name as the CGI script that the form calls is one used by all the online forms here and requires these specific names.

On this particular form, depending on the checkbox clicked, a persons name will be added to the textbox before the form is submitted. Does anyone know of any other way I can get this textbox populated with the values from the checkboxes? Any creative thoughts to save the user from typing in the names directly?

Thanks again for your input all.
 
you could try innerHTML when the check box gets clicked it changes the the entire box, you could still use the name .send, and use the value= to put the persons name on the box.
 
how about trying this ?

<html>
<body onLoad=&quot;document.forms[0].elements[0].value='New text'&quot;>
<form>
<input type=&quot;text&quot; name=&quot;.Send&quot; value=&quot;Initial text&quot;>
</form>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top