Unable to conditionally hide or show a CiviCRM Options field when using eventid query parameter

Created on 19 February 2024, 10 months ago
Updated 14 June 2024, 6 months ago

1.0 Problem/Motivation
I have a webform which allows event registration. I pass in the event as a query parameter (`event1=2`) and want to hide the event option field if that has been passed in. However, it doesn't matter what options I choose in conditional logic. The field is always hidden.

2.0 Detailed steps to reproduce (embed screenshots)
Create a webform and enable civicrm processing.
Add event registration for Contact 1 and set event to User Select
On the Event field, go to "Conditional", and set "Hide" if "All": Events[CiviCRM Options] Checked.
View the form and pass in a valid event as query paramater `event1=2`
The field is hidden
View the form and do not pass in a query parameter.
The field is still hidden.

🐛 Bug report
Status

Active

Version

6.2

Component

Code

Created by

🇦🇺Australia nicholosophy Brisbane

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @nicholosophy
  • 🇮🇳India jitendrapurohit

    Hmm, normal webform conditionals for checkbox groups works on individual checkboxes, so eg if I have a checkbox with Color: Red, Orange, Green.

    The conditional i need to write would be Hide if Any of

    Red is checked.
    Orange is checked.
    Green is checked.

    CiviCRM Options seems to be providing multiple types - select, multiselect, checkbox, radio & don't provide the separate logic for handling the conditionals.

    One way to fix your usecase might be to re-type the element to use checkboxes (Can be done from Edit Element page).
    Save
    Then modify the conditional to check for each checkbox option as mentioned above.

    Does that help?

  • 🇦🇺Australia nicholosophy Brisbane

    It doesn't help at the moment as I'm using a select field, not checkboxes. Even when I switch to a standard select list I'm not sure it works. I don't know if it would work with the standard query parameter completion that is in webform.

    What I've done with a different site is create a webform handler that checks the #default_value has been set and then hides the select field. I've found that if it is hidden by default, #default_value doesn't get set.

Production build 0.71.5 2024