The logic that a component which is hidden should be considered by conditional logic to have an empty value conflicts with components of the type 'hidden'. These components can be sent to the browser, used as a source for other conditionals and shown/hidden.

Because they are always initially hidden (by definition), they have an empty value for the purpose of other conditionals in the browser. The server does not have this issue because it doesn't look at the actual visibility of the components.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

  • DanChadwick committed b386416 on 7.x-4.x
    Issue #2456079 by DanChadwick: Hidden components should not be...
DanChadwick’s picture

Status: Active » Fixed
FileSize
1.93 KB

This patch changes the logic for components of type 'hidden' only to reflect whether it has been hidden/shown by conditionals, rather than whether it is actually visible.

This causes two desirable effects:

  1. The value of a hidden element that is itself not show/hidden by a conditional rule will be the value of the hidden element, not empty.
  2. A hidden component that is show/hidden by other conditions will change its value from its default to empty (and back) as needed.

Note that only hidden components of 'hidden type' = 'hidden element' and not of type 'secure' can be used in browser conditionals.

Also note that once a hidden element has been submitted to the server as hidden (not shown), it will forever have an empty value. Future versions of webform may have the ability to set values to change this behavior.

Committed to 7.x-4.x.

DanChadwick’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Status: Fixed » Patch (to be ported)
Related issues: +#1840776: Components with a value that are hidden by conditionals should be empty
fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Status: Patch (to be ported) » Fixed

Committed and pushed to 8.x-4.x. Thanks!

  • fenstrat committed 5f646d1 on 8.x-4.x
    Issue #2456079 by DanChadwick: Hidden components should not be...

Status: Fixed » Closed (fixed)

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