Thanks,
Thierry.
> Let's say I have 2 text boxes and 2 radio buttons.
> Is it possible to disable one text box when the user selects a radio button
With HTML? No.
With client-side scripting: probably, but users can turn scripting off,
so you better be sure that you're not relying on that when you evaluate
the forms submission.
Say, if you only want one text box to be usable, why have two of them?
Perhaps if you'd tell people what it is you aim to achieve, instead
of presenting a half-formed solution to an unstated problem, someone
might be able to offer a better suggestion.
(f'ups narrowed)
Within a single form, with HTML only, no.
If you are creating a multi-page form, you can put the radio buttons
on a page prior to the text boxes. The CGI script that receives data from
the first page and generates the second page can tailor the set of input
widgets in any way that it wants.
It does make your CGI programming much more interesting, however.
To answer Alan's question, why have two text fields in the first place,
the answer is that it depends on the application. The alternative
radio button may require use of both text fields. Radio buttons might
tell you that you want to change the prompt text for one or both fields.
Use of the field may change. It depends.
--
Diane Wilson | All their brains are in their heads,
dewi...@pobox.com | where brains ought to be. No one sits
http://www.lava.net/~dewilson/ | beside their brain. No one but me.
http://www.acm.org/chapters/trichi/ |
> To answer Alan's question, why have two text fields in the first place,
> the answer is that it depends on the application.
Sure it does. In case it wasn't clear, I was inviting the original
poster to ask themselves the question, and/or reveal a little more about
the underlying problem. It wsn't that I was short of possible answers
myself ;-}
> Use of the field may change. It depends.
Indeed it does. If I gave the impression that it was otherwise, then
let me correct that impression. Thanks.