Multiple Choice Option Triggers an Event

I have a Multiple Choice menu consisting of a few options.

I need a show() event to happen depending on which option box is ticked. In this list, if I select “Other” I need to show a textbox below the list.


Similarly, in this Multiple Choice set, depending which option is selected I would like to trigger certain events.

If this is possible, I would appreciate any help.
Thanx.

Use ----> Checkbox-Groups

Edit: Ahmad will explain you… :grin:

Hi @digitalzemb

You can do so by making use of the onChange( ) event handler to check which fields are selected, and if “Other” is selected show a box below.

$w("#options").onChange( (event) => {
    const values = $w("#options").value;
    if (values.length > 0) {
        if (values.indexOf('other') === -1) {
            // Hide the box
            if (!$w('#otherBox').collapsed) { $w('#otherBox').collapse() }
        } else {
            // Show the box
            if ($w('#otherBox').collapsed) { $w('#otherBox').expand() }
        }
    } else {
        // Hide the box
        if (!$w('#otherBox').collapsed) { $w('#otherBox').collapse() }
    }
})

Hope this helps~!
Ahmad

Hi Ahmad,
It works perfectly, I could kiss you!
Thank you. I have been struggling with this for a few months now.

Thanx @russian-dima

@russian-dima :joy::joy:

I appreciate your thankful feelings, but you better not :mask: :joy::joy:
WOW, a few months!! I’m glad that I was able to help.