[support] complex checkbox / radio combo

Carl Wiedemann carl.wiedemann at gmail.com
Sun Nov 7 19:15:04 UTC 2010


There are two tasks at hand:

Task A. Determining what fields should be used to store the data.
Task B. Configuring the form to have proper validation and dynamic behavior.

Task A. can be done via CCK alone. Task B would require custom PHP and
JavaScript/jQuery to implement fully.

Here's how I would approach task A. There will be three fields total.

1. Create a field called "Type" (or whatever makes sense) which is 3 radio
buttons.

o Age group
o All ages
o Skill-based

2. Create a field called "Ages" which is 5 checkboxes that states "If age
group was selected for type, please select the appropriate age group(s)."

[ ] 4-5
[ ] 6-7
[ ] 8-9
[ ] 10-12
[ ] 13+

3. Create a field called "Skills" which is a textfield that state "If
skill-based was selected for type, please enter the relevant skills."

>From here, you are faced with Task B. Some form validation would be added
such that if indeed "Age group" or "Skill-based" are selected for "Type"
that the respective sub-fields contain values. JavaScript/jQuery would hide
the checkboxes and textfield if the respective radio button isn't selected.

Arguably, the form is acceptably functional without completing Task B --
that is, making sure correct data are entered becomes administrative (a
human task) rather than technical (a machine task).


On Sat, Nov 6, 2010 at 7:09 PM, Marty Landman
<mlandman at face2interface.com>wrote:

> Hi, I've been asked if I can accomplish the following for a create
> content form where the content-type is CCK generated.
>
> Age group:
>
> 1.  4-5
> 2.  6-7
> 3.  8-9
> 4.  10-12
> 5.  13+
> 6.  All ages
> 7.  Skill based  ____________________________________________
>
> with the lines before the ages being a checkbox, and the ability to
> check multiple boxes.  After "Skill based" we need a box to write in
> the skills.  Is it possible to be able to check multiple boxes on the
> first 5, but if you check all ages or skill based you can only check one?
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> I'm thinking that at least conceptually if I could make 1.-5. into a
> checkbox group, and then have that checkbox group be in aggregate a
> radio button (if that even makes sense) with 6. & 7. also being radio
> buttons 2 & 3, and then the test field for skill based would
> magically become required iff #7 was selected.
>
> Anyone know of any examples of something like this being done? How
> would it be approached? Can it work with CCK? Alternatively I wonder
> how to get close to what they want. I mean from a functional pov this
> makes perfect sense, doesn't it?
>
> Marty
>
> --
> Open first 10 Google results in 10 new tabs
> https://addons.mozilla.org/af/firefox/addon/181910/
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20101107/01097e84/attachment.html 


More information about the support mailing list