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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

maintaining state by appending a form or query string

Status
Not open for further replies.

webscripter

Programmer
Jul 29, 2002
266
0
0
US
Hi everyone,

I want to add a hidden input field to any form sent on submit. The hidden field can't exist. I want to add the name and the value on submit to the items alread in the form.

Then also on the loading page I need to get the value of the form input I created.

Does anyone know how to do this?


Thanks
Tricia
yorkeylady@earthlink.net
 
banner.png


What exactly do you want to do?

(1)If you have a form with a single text-box, for example, do you want to append the 'hidden' data to that data, e.g. if the text-box held "hello" in it and the 'hidden' data was to be " world!", would you want to change the value of the text box to "hello world!" when it is submitted or

(2)Do you want to create a
Code:
<input type=&quot;hidden&quot;...>
on the fly? or

(3)Anything else...

If you want to do (1), the code is simple.

Code:
...
<form name=&quot;formName&quot;...>
  <input name=&quot;textBox&quot; type=&quot;text&quot;...>
  <input type=&quot;submit&quot; value=&quot;  submit  &quot; onClick()=&quot;document.formName.textBox.value = document.formName.textBox.value + ' world!'&quot;>
</form>
...

If you want to do (2) I think you'd have to manipulate the DOM in order to add a node to the form. I'm not going to bother going into this unless that really is what you want to do...

Hope this helps...

keteracel



[sub]( keywords: form hidden input field text textbox onclick submit keteracel )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top