sending input value even if disabled

L

lehmann

Hello,

Is it possible to have a disabled input in a form whose value could be
sent when the form is submitted.
I just need the user not to be able to change the input value, but
this value is significant and must be sent
thanks for any help,
G.
 
M

Martin Honnen

lehmann said:
Is it possible to have a disabled input in a form whose value could be
sent when the form is submitted.
I just need the user not to be able to change the input value, but
this value is significant and must be sent

Then use
<input readonly type="text" name="inputName" value="Kibology">
or
<input type="hidden" name="inputName" value="Kibology">

You script the readonly attribute as the
element.readOnly
property with boolean values e.g.
element.readOnly = true;
 
M

Michael Winter

Is it possible to have a disabled input in a form whose value could be
sent when the form is submitted.
I just need the user not to be able to change the input value, but
this value is significant and must be sent

Not reliably. You could remove the disabled status just before sending the
form, but without JavaScript, this method won't work.

If the user doesn't need to see the data, you can store it in a hidden
field. If you need the user to see the data, you can still display it in a
disabled field, and keep the hidden and disabled values in sync.

If the data is in an INPUT or TEXTAREA control, you could use the readonly
attribute to prevent modification. Read-only controls are still submitted.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top