Table of Contents
Updated by Ingo
Show and hide fields with a checkbox
felderEinUndAusblenden('HTML ID Checkbox', ['HTML ID 1', 'HTML ID 2']);
However, the placeholder HTML IDs still have to be replaced with the correct values.
Where do you find the correct HTML ID designation?
You can also find the HTML ID in the editing area of the respective attribute.
The corresponding form on the website looks like this. After selecting the checkbox "I need a company invoice." both fields for the company and the address are automatically displayed.
Show and hide fields with a radio button or dropdown
Showing and hiding a selection after a radio button or dropdown works very similarly to a checkbox. You can also show and hide different information, for example text fields and a checkbox. We will take a closer look at this later in the example.
felderEinUndAusblenden('HTML ID RADIOBUTTON', '', ['HTML ID 1', 'HTML ID 2']);
felderEinUndAusblenden('HTML ID RADIOBUTTON', '', ['HTML ID 1']);
felderEinUndAusblenden('HTML ID RADIOBUTTON', '', ['HTML ID 2', 'HTML ID 3', 'HTML ID 4']);
This code is very similar to the one for the checkbox. In addition, the value of the selection of the radio button / dropdown must always be entered. A line of code must be added for each value of the selection. Only the fields in the square brackets are displayed when the user selects them. All other fields are hidden. Please note that the value is entered exactly as it is noted in the form for the radio button / dropdown. Only the upper and lower case is irrelevant here.
Your event consists of the actual event and an after-show party. You now want to ask your guests at the event whether they would like to participate in the event and the party or only in a part of the event. You can use a radio button selection for this:
Depending on which event sections the guest attends, you may want to make further enquiries. The event includes a meal. For example, you could ask for food preferences for participation in "event only" and "event and aftershow". We assign the values "meat", "vegetarian" and "vegan".
As the party could go on until late in the evening, you would like to offer a free bus shuttle to all participants of the after-show party and would therefore have to include the request for the bus shuttle by checkbox.
Let us summarise:
- Variant 1: Guest only comes to the event. Only the query for food preferences should appear (drop-down selection between meat, vegetarian and vegan).
- Variant 2: Guest comes to the event and to the aftershow. Therefore, the dropdown query for the meal and the checkbox for the bus shuttle should appear.
- Variant 3: Guest only takes part in the after-show. Thus, only the request for the bus shuttle should be queried.
In your registration form, the query appears as follows:
Participation in the event only:
Participation in the event and the aftershow:
Participation in the aftershow only: