Updatable form empty fields

Hi,

Create a validation function that will iterate the ‘required’ input fields and if one of them is empty - trigger a notification. Otherwise, it should go ahead and submit the data.

for example:

const inputList = ["adults", "kids"]

export function button1_click(event) {
 let isValid = true;
    inputList.forEach((input) => {
 if ($w("#" + input).required && ($w("#" + input).value) == "") { 
         isValid = false;
       }
    })
    isValid // should contain true if form is valid, false otherwise
}