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

Comments

rjlang created an issue. See original summary.

danchadwick’s picture

Reproduced.

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.

rjlang’s picture

That 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

danchadwick’s picture

Title: Conditionals ignore user changes in form (on Windows, not Mac) » Conditionals setting required need the component to be configured with required on.
scresante’s picture

I 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.
Only local images are allowed.

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

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.
Only local images are allowed.

To Summarize:

  • Existing large webform with work-around applied (required conditional sub-fields)
  • ** Works on page
    ** Does not work in modal

  • New 1-page webform on existing website, conditional sub-fields unrequired
  • ** works on page
    ** Does not work in modal

  • Fresh drupal install, multi-page form, multiple unrequired conditional sub-fields
  • ** 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?

scresante’s picture

I think the title of this issue should be:
Conditional fields displaying incorrectly on Windows

scresante’s picture

After 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?

danchadwick’s picture

Version: 7.x-4.10 » 7.x-4.x-dev
Status: Active » Fixed
StatusFileSize
new1.92 KB

Added warning message for any components that are conditionally required but not configured as required.

Committed to 7.x-4.x and 8.x.

  • DanChadwick committed 21e6bb5 on 8.x-4.x
    Issue #2555853 by DanChadwick: Added warning that component must be...

  • DanChadwick committed bbf6443 on
    Issue #2555853 by DanChadwick: Added warning that component must be...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

pio.fernandes’s picture

Somehow, 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.

dmsmidt’s picture

For follow searchers, the issue mentioned in #12 is here #1619462: Compatibility problem with conditional_fields module Scratch that, is for different module. Anyone found a solution?