Closed (fixed)
Project:
Webform
Version:
7.x-4.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Jan 2013 at 11:04 UTC
Updated:
15 Apr 2015 at 16:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sylvain lavielle commentedsame issue here
Comment #2
danchadwick commentedRemember that required fields that are hidden are no-longer required. So in your use case, use the CALL ME BACK checkbox to show the required PHONE NUMBER field.
Please re-open if there is a more compelling use case that the above doesn't address.
Comment #3
sylvain lavielle commentedHello Dan.
You're right, but in my case (and I assume in Mark's case too) the phone number still providable by users anyhow : The phone number field should never be hidden. In one case, its mandatory in another its optional, but hiding it doesn't suit my case.
Comment #4
marcvangendI completely agree with sylvain. Hidden fields must not be required, but that doesn't mean that not-required fields must be hidden.
Comment #5
adanielyan commentedI think the workaround could be creating two phone number fields, one required and one not required. When the "Call me back" checkbox is unchecked the not required field will be shown and the required one will be hidden. When the checkbox is checked the required phone number field will be shown and the not required one will be hidden.
Comment #6
sylvain lavielle commentedYes certainly but it's quite dirty :)
Comment #7
sylvain lavielle commentedThe way i'm dealing with for now is by adding a custom #validate function to the form webform to check the case backend side and a JQuery script for applying "required" display on the needed fields on the frontend side. That works, but it would be so great if webform conditionals would be able to add two more actions ("set mandatory" & "set optional") to the classic "Hide" and "Show" in conditions.
Comment #8
danchadwick commentedSeems pretty reasonable. Patches welcome. Remember there is a server and a jQuery part.
Comment #9
sylvain lavielle commentednot a piece of cake though :) ...
Comment #10
danchadwick commentedActive is the correct status as there currently is not patch the "needs work". :) Doesn't matter much, but I sometimes search for "needs work" issues to see if I can fix the patch.
Comment #11
danchadwick commentedWorking on this. For the record, a webform-related module can respond to the insertion and removal of the required span with something like (just an example -- you wouldn't want this):
Comment #12
danchadwick commentedHere's a patch for review.
Comment #13
danchadwick commentedComment #14
danchadwick commentedCommitted to 7.x-4.x.
Comment #16
danchadwick commentedComment #17
marcvangendThanks Dan!
Comment #18
danchadwick commentedTesting is welcome. ;)
Comment #19
fenstratCommitted and pushed to 8.x-4.x. Thanks!
Comment #22
danchadwick commented