These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:06 pm Advanced search

WebForms 2: how to specify requirement of at least one field

Do you think the HTML spec should do something differently? You can discuss spec feedback here, but you should send it to the WHATWG mailing list or file a bug in the W3C bugzilla for it to be considered.

WebForms 2: how to specify requirement of at least one field

Postby FataL » Mon Apr 07, 2008 10:32 pm

Is there a way in WebForms 2 to specify something like these pretty common cases:
  1. At least one field is required
  2. Only one field from multiple is required
  3. A field is required if other field is checked (non empty)

If there is no way, what would you recommend to do?

For the first case I use:
Code: Select all
<input name="a" required="b,c">
<input name="b" required="a,c">
<inbut name="c" required="a,b">
FataL
<h6>
 
Posts: 9
Joined: Thu Jun 28, 2007 7:02 pm

Postby zcorpan » Tue Apr 08, 2008 3:51 pm

I think you need to use scripting for this. See http://www.whatwg.org/specs/web-forms/c ... roduction0 for how to hook up to the WF2 validation framework with scripting.

HTH
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to Feedback on the Specs

Who is online

Users browsing this forum: No registered users and 1 guest