Click to See Complete Forum and Search --> : greyed out form inputs?
jacen6678
10-12-2003, 06:42 PM
I would like to set up a form such that the user must fill in one field (ie: name) before he can fill in other fields (ie: address, zip code). However, the user must be able to see the address and zip input fields at all times. Further, there must be some visual cue that the input fields are unavailable while name is empty.
Is there some way to grey-out or ghost input elements? How would you do this?
Add disabled="disabled" to the form elements to disable them... You'll need some JavaScript (and a bit of creativity to keep it working for non-JS users) to make enable the next field, once they fill out the pervious...
IncaWarrior
10-14-2003, 09:10 PM
mmm disabled="disabled" looks kind of weird
But with XHTML we must not have empty attributes (a requirement that I carry over to HTML 4.01): http://www.w3.org/TR/xhtml1/#h-4.5
nkaisare
10-14-2003, 10:09 PM
How do you plan to service the people who might browse your website with javascript turned off?
What advantage does this (disabling/enabling fields) give you or the user? Not all users fill out their details in the same order as you do. For example, when I fill out a form, I start with the textbox that is nearest to my mouse (if no textbox is focused currently), just because it is faster for me.
There are some valid reasons to show or hide form elements (using javascript or otherwise)... but your example doesn't seem to be one of them.