W3C home > Mailing lists > Public > public-html@w3.org > April 2015

Re: Form element dependencies

From: Andrea Rendine <master.skywalker.88@gmail.com>
Date: Fri, 17 Apr 2015 14:10:23 +0200
Message-ID: <CAGxST9mj3mKc4fRB=gcTxqBTvfaqKVo+Un9eAm3bi3ct6DqMEQ@mail.gmail.com>
To: sisbluesteel <sisbluesteel@aol.com>
Cc: "public-html@w3.org LIST" <public-html@w3.org>
Hi! No worries for the late reply, I'm sure everybody has multiple
things to attend to.

> Well, I'd bind onchange-listener to all of the radio buttons with the same $name, and check what get's activated.
> We can listen to changes in their parent select-element and check if the selected option the target.
I was sure you had some workarounds for the issues I highlighted. I
just wanted to point them out so that anyone trying could avoid my
mistakes :)

> There hasn't been any discussion about multiple dependencies, IIRC.
Correct.
I took the idea from the project I was working on: 2 fieldsets, each
one enabled by a checked control. The user can choose to fill in
either one of them, or both, but at least one. At the beginning I had
checkboxes, so the user could check the one s/he needed or both of
them. But then I realized that unchecking all the boxes would mean
hide all the fieldsets and this was not acceptable. So I turned to
radio buttons in the form of A/B/ALL choice (this way at least one
control must be checked).
However, the first 2 examples in my polyfill list had the option of
multiple dependencies, so I guess it should be considered.

> Is there a need to support both cases (Logical AND/OR on all the dependencies states)?
Intriguing question. The examples I mentioned above allow multiple
dependencies in both "any" and "all" variants.
 - dependsOn seems to consider AND as default (OR requiring a slightly
more complex syntax)
 - jQueryFieldDependencies is more direct and has a "ruleLogic"
parameter switching between the two conditions. Here "any" (OR) is
default.

Consider that support for both AND/OR conditions could require even
more complex cases, such as (a AND b) OR (c AND d), which would be
interesting but maybe difficult to achieve.
I hope to receive some feedback about which is most popular between
the 2 variants. I would suggest the "or", as in the simple cases of
checkboxes/radio buttons/select options, the "and" can be handled as I
said above, with an "all" explicit control.

Yours sincerely,
Andrea
Received on Friday, 17 April 2015 12:10:56 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:16:43 UTC