- From: Matthew Raymond <mattraymond@earthlink.net>
- Date: Mon, 30 Oct 2006 19:32:58 -0500
Lachlan Hunt wrote: > Actually, conditionally required fields would be a very nice addition. > I built this site earlier this year, which has conditionally required > fields. > > https://www.edentiti.com/create/details.jsf > > See the Postal Address section. It's required unless it's the same as > the residential address. If you check the "Use residential address" > checkbox, the fields are no longer required. If you uncheck it again, > they are. The JS updates the fields as soon as you check or uncheck the > box. In the case you listed, the scripting is minimal. You would use something like this: | <input [...] onforminput="required=!use_res.checked"> The equivalent in Forms-Lite would be this: | <input [...] needed="use_res = false"> While the formula in the latter is easier to understand for beginners, scripting is more flexible: | <input [...] onforminput= | "required=!use_res.checked; disabled=use_res.checked;"> You could turn any binary attribute into one that takes a formula. I just don't see a clear advantage in it. In the best cases, you're just creating a new, simpler scripting language. In the worst case scenario, you end up implementing something like |onformchange| or |onforminput| anyways due to the limitations of the formulas.
Received on Monday, 30 October 2006 16:32:58 UTC