Retrieving Disabled Form Elements

Status
Not open for further replies.

beefkirky

Ars Scholae Palatinae
802
As far as I've been able to see, when I set a form element to disabled, and then submit the form, all the form element values are submitted except those elements that are disabled.

Now, when I disable the element, it is not because the value of it is gone, its just that I don't want the user to mess with the contents.

Is there some way to disable elements and still have their values returned to a cgi on the submit?
 
i have always used hidden form fields to do this. There are other solutions though -

- you could not disable the field and then have and onfocus() event that immediately calls a moveFocus() to the next form field ie. the user cannot actually do anything with the field even though it is still active for the purposes of the form submission

- you could put the values you want to hold into a cookie and then destroy the cookie after you have processed to form

hmmm - the hidden form field is going to be the easiest way though.

That is a somewhat brittle solution, however, as it relies on the client browser to function

yep - any solution that I can think of right now would be dependent on that too, because without some kind of unique id for the client there is no reliable way to store the info server side.

unless you do something like write the values out into the url and then build the form submission url to incorporate them too - actually that is not a bad idea.....hmmmm
 
Status
Not open for further replies.