Hi,
It would be great having Conditional Logic in captcha elements, as for other regular webform element (select, text, etc...).
For exemple, I have a "subscribe to newsletter" bloc which only display an email field, but then display other (required) fields as soon as a user begin filling it.
Thanks.
Conditional Logic exemple options:
Actual captcha element options
Actual captcha element options:
Conditional Logic exemple options

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

camdarley created an issue. See original summary.

jrockowitz’s picture

Status: Active » Closed (won't fix)

Not possible because conditional logic is all client-side and does not disable the CAPTCHA element.

camdarley’s picture

Status: Closed (won't fix) » Active

@jrockowitz Sorry to re-open this and I understand your point, but the goal here isn't to disable the captcha, but only to toggle visible/invisible states.
Waptcha element would still be present in html, only hidden with css/javascript until user fill another field.

jrockowitz’s picture

The form won't submit if the CAPTCHA element is hidden, which will be very confusing for most users.

You can work around this, by adding a custom #states property to your CAPTCHA element, which will enable the 'Conditional Logic' UI

states:
  visible:
    ':input[name="checkbox"]':
      checked: true

camdarley’s picture

Status: Active » Closed (works as designed)

Perfect, it works! I wasn't aware of this...
Many thanks!