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

How do i submit a text field that is disabled? 1

Status
Not open for further replies.

rico14d

Programmer
Apr 8, 2002
135
GB
Im using a text field in a form which is disabled but i still want it to submit with the other fields?

Is there an easy way of doing this or am i going to have to use a hidden field to submit its value?
 
I believe hidden field is the way to go. Otherwise maybe you want to take a look at the READONLY attribute which is very similar. Gary Haran
 
<script languague=&quot;javascript&quot;>
function passvalue() {
document.newform.storer.value = document.disabledform.disabledinput.value;
document.newform.submit()
}
</script>
...
<form name=&quot;disabledform&quot;>
<input name=&quot;disabledinput&quot;>
...
</form>
...
<form name=&quot;newform&quot;
<input type=&quot;hidden name=&quot;storer&quot; value=&quot;&quot;>
...
<input type=&quot;button&quot; onclick=&quot;passvalue()&quot; value=&quot;click here to submit&quot;>
</form>

was that it?
if no what do u mean by disabled ? someone knowledge ends where
someone else knowledge starts
 
When a textbox is disabled you cant change the value.
Unfortunately it is not submitted when it is inside a form.
The Readonly attribute allowed me to do this.

Its a little shorter than using javascript.
 
the JS example dosent change your previous <input>
its modifiying a <input> inside your <form>
.... someone knowledge ends where
someone else knowledge starts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top