- From: Ian Hickson <ian@hixie.ch>
- Date: Thu, 10 Jun 2004 19:38:33 +0000 (UTC)
On Tue, 8 Jun 2004, Judah Frangipane wrote: > > I was thinking of some sort of expression for the required field such as: > > <input type="text" name="spouses_name" required="if(maritalstatus.value=='married')" /> You can do this, but you have to do it backwards -- set the required attribute when the other field changes. As in: Married: <input type="checkbox" name="married" onchange="spouseName.required = checked"> Spouse's name: <input type="text" name="spouseName"> (Although you're more likely to just toggle disabled instead of required, to be honest.) You could also do it in the "forward" way like this: <input type="text" name="spouses_name" onformchange="required = maritalstatus.value=='married'" /> ...where onformchange fires every time the form changes. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 10 June 2004 12:38:33 UTC