The problem is that on Windows but not Mac, the conditional logic is not getting updated with the user's changes to the form after a validation failure.
Here's how to reproduce this problem. Create a webform with two components:
Component radio_options is a select with two values: 0|not_needed, 1|needed.
Component more_text is a text_area.
Set a conditional: if radio_options is needed then more_text is required.
Then to test, first set radio_options to needed and submit. The form will generate an error saying that more_text is required (correctly).
Then, without re-loading the page, change radio_options to not_needed and submit (which should go through, according to the conditional logic). On Mac (Safari, Chrome), the revised submission goes through correctly. However, on Windows 8.1 (Explorer, Chrome), the form still fails to validate and claims that more_text is a required field.
However, if you refresh the page and start over with radio_options=not_needed and more_text="", it goes through (correctly) on all platforms.
Any suggestions on where to look or how to force the conditionals to refresh themselves upon submission would be most appreciated.
Robert
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | webform-conditional_required_warning-2555853-8.patch | 1.92 KB | danchadwick |
Comments
Comment #2
danchadwick commentedReproduced.
To avoid this problem, set the required validation on for more_text. The conditional logic assumes that the component is initially required. Otherwise the required HTML is not generated.
It's not clear to me how to address this. Maybe just warn on the conditionals page if any of the targeted components that can be conditionally required aren't defined as required. Otherwise we get a chicken-and-egg between setting the component and setting the conditional. Plus we have the issue of addressing existing webforms prior to whatever patch we make.
Comment #3
rjlang commentedThat worked.
I think the warning on the Conditionals page would suffice. Something like this: "Any component whose required status is determined from a conditional should be set to be required initially." It was especially puzzling that there was a platform (but not browser) dependence.
Thanks,
Robert
Comment #4
danchadwick commentedComment #5
scresante commentedI am building a multi-page webform using lots of conditionals. It is multi-page using webform_steps, AJAX enabled and is in a modal using modal_forms. This bug is going to seriously impact the project because it was expected to use a modal form, which it looks like we'll be dropping now as a quick fix.
It's really mindblowing that this bug is dependent on the OS!
I am using Windows 7 and Chrome to run these tests.
The work-around described above does not work for my existing, large, multistep webform when it is in a modal.
The fields still show up but are now just marked as required.

However, when I go to the webform page itself, and do not use the modal, it (the workaround)does work.

I confirmed the above with a simplified webform: it doesn't work in a modal, but it does on a page.
So to test this further, I fired up a fresh drupal install, quickly rebuilt the feature.
The bug does not exist with a simplified webform in a modal on a fresh site with unrequired conditional fields, even with multiple pages.

To Summarize:
** Works on page
** Does not work in modal
** works on page
** Does not work in modal
** works in both modal and on page without issue
So there are there are interactions between my theme, modal_forms, and webform which all work together to cause this issue... but why only windows?
Comment #6
scresante commentedI think the title of this issue should be:
Conditional fields displaying incorrectly on Windows
Comment #7
scresante commentedAfter disabling AJAX mode and not using a modal form to display the webform, these problems resolved themselves. Have there been similar issues in the ctools issue queue?
Comment #8
danchadwick commentedAdded warning message for any components that are conditionally required but not configured as required.
Committed to 7.x-4.x and 8.x.
Comment #12
pio.fernandes commentedSomehow, getting the 'required' property on by default doesn't conjugate with Clientside Validation module. It always sets the field as required. But I'm guessing that is a Clientside Validation module's issue.
Comment #13
dmsmidtFor follow searchers, the issue mentioned in #12 is here #1619462: Compatibility problem with conditional_fields moduleScratch that, is for different module. Anyone found a solution?