I have a form where people register for an event. They can have guests. For each guest I need 5 input fields. They can have up to 6 guests.
I have created a dropdown where they can choose from 1 to 6.
So for each option.onclick I need to expand 5 fields. What would be the best way of doing it? Do I have to repeat 5 times an expand()? Is there a way of looping?
Thanks
My form was created with the wix editor so all my fields name are #input1, #input2… Is there a way of creating #inputx with x changing?
Doesn’t work, please help
$w ( ‘#dropdown1’ ). onChange (( event , $w )=>{
// all fields are collapsed at the beginning
let theSelection = $w ( ‘#dropdown1’ ). selectedIndex ;
//theSelection will help me later on, to loop up to 6 times;
// now I am just testing it for one value
if ( theSelection !== 0 ){
// show fields for one guest
let y = 7 ; // my radioGroup starts at 7 and will be incremented later on
for ( let i = 10 ; i < 16 ; i ++) {
$w ( '#radioGroup' + y ). show ();
$w ( '#input' + i ). show ();
}
nothing shows up
solved, I need to put expand and not show…