Hi All,
I am building an RSVP form and based on attendance, the number of adults and children I want to hide/show certain fields.
The if statement does not seem to work when I select any of the else if options.
This is my whole code - I have tried everything under the sun. Do you see any error?
I have tried building it bit by bit and it all start going wrong as soon as I input multiple conditions in the if statement and else if
export function yesNoRadio_onChange(event) {
var Attendance = Number($w('#yesNoRadio').value);// yes = 1, no = 0
console.log(Attendance);
}
export function adultNo_onChange(event) {
var NoAdults = Number($w('#adultNo').value);//options:1, 2
console.log(NoAdults);
}
export function childrenNo_onChange(event) {
var NoChildren = Number($w('#childrenNo').value);//options:0,1,2,3,4
console.log(NoChildren);
}
export function next1_onClick(event) {
var Attendance = Number($w('#yesNoRadio').value);
var NoAdults = Number($w('#adultNo').value);
var NoChildren = Number($w('#childrenNo').value);
if (Attendance === 0){
$w("#slideshow1").changeSlide(3);
} else if (NoAdults === 1 || NoChildren === 0 || Attendance === 1) {
$w("#slideshow1").changeSlide(1);
$w('#nameAdult2').hide();
$w("#childernText").hide();
} else if (NoAdults === 2 || NoChildren === 0 || Attendance === 1) {
$w("#slideshow1").changeSlide(1);
$w('#nameAdult2').show();
$w("#childernText").hide();
} else if (NoAdults === 2 || NoChildren > 0 || Attendance === 1) {
$w("#slideshow1").changeSlide(1);
$w('#nameAdult2').show();
$w("#childernText").show();
} else if (NoAdults === 1 || NoChildren > 0 || Attendance === 1) {
$w("#slideshow1").changeSlide(1);
$w('#nameAdult2').hide();
$w("#childernText").show();
}
}
Thank you in advance to anyone who can assist
Letizia