Closed (outdated)
Project:
Webform Validation
Version:
6.x-1.3
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Sep 2010 at 13:32 UTC
Updated:
29 Feb 2016 at 19:44 UTC
Jump to comment: Most recent
Comments
Comment #1
brightboldOoh! Yes. I was just looking to see if anyone was doing this - that's exactly what I'm looking for.
Comment #2
brightboldOops. Double-submit. Please delete.
Comment #3
svendecabooterThis kind of functionality will be complex to fit into the architecture of this module...
I'll have to investigate if there's an elegant way of doing this...
If your requirements allow you to spread the form elements over multiple pages, you could easily fix this with Conditional Rules in webform 3.x.
Just add the Yes/No select component on page 1, and on page 2 add some required textfields. Make sure to set the Conditional rules for these textfields (or surrounding fieldset) to only show when the value of the component on page 1 "is one of" "no" / "0" (or whatever the key is for "No" on your Yes/No component).
Comment #4
svendecabooterComment #5
brightboldThanks @svendecabooter, that's a good tip. I'll try that.
Comment #6
bancarddata commentedI would be interested in a feature like this in the 7.x branch as well. In my case (and I would use this case on probably every site I ever do), I would like to have a radio button called "Preferred method of contact", with options of "E-mail" and "Phone". Depending on this selection, I would want to make either the "E-mail Address" field or the "Phone number" field required (but not both).
Comment #7
svendecabooterThat'll not be easy to do.
The #ajax functionality in D7 would allow for this, but it's hard to make this generic.
We would need a UI to attach the #ajax behavior to a selected form element, and then a way to wrap the fields that need to change into a wrapper div or fieldset, so they can be reloaded via AJAX with updated 'required' settings.
Even though i'd like to add that, it'll be a lot of work to make this generic (unless i'm missing an easier approach), and somewhat out of scope of the purpose of this module.
Short term you might be easier off creating a custom module with a hook_form_alter adding the proper #ajax property on the element you want to have trigger the change in behavior, and grouping together the elements that need to be dependent on it.
Comment #8
bancarddata commentedThanks for the explanation. It does indeed sound like much more trouble than it is worth.
Comment #9
liam morlandDrupal 6 is no longer supported. If this issue exists in a later version of webform_validation, please re-open and update the version number.