I can do it with the normal form inputs by putting everything in a form container and selecting “required”, but what about multiselect input element? I need users to choose at least one option.
Hey @raelyn. You can use Regex.
- Create a boolean variable. This variable will store if the multi-select is empty or not.
- Create a ‘On change’ workflow to update the variable value. Put this code.
/[^,\s]+/.test(yourVariable)
Now if the multi-select is empty, the variable value will be false, else true.
Himanshu
WeWeb agency
The multiselect is not a simple html input element, so there isn’t a required attribute to trigger the browser validation.
You can use the onchancge event to check if the currentSelection variable (which is an array) has a length >0 to show/hide an error message in realtime. You can perform the same check before submitting the form.
Thanks @dorilama & @Himanshu. Instead of showing / hiding an error message, how do I get this yellow box to show up instead?
Because this is the error message that shows up for all the other inputs (like in the screenshot), so for consistency sake, I want this to pop up for the multiselect input element too.
have you tried the required option of the multiselect?
Where do I find the required option of the multi select input element? I can find it for the normal input elements but not for the multi select input element.
right. It looks like the code on github uses it in the element but it’s not exposed as an option in the editor.
Maybe you can ask the team if this feature is planned to be released