To be brief, I am creating a custom order request form for a site and I need to be able to reveal 5 different strips that are collapsed on load. Each strip contains drop boxes and other user input for ordering product and counts as 1 “item”.
I’ve defined an array before the $w.onReady:
let orderItem = [“#item1”,“#item2”,“#item3”,“#item4”,“#item5”]
I’m calling the function as so:
$w(“#addItemButton”).onClick((event)=> {
addNewItem();
});
and I’ve written the function:
function addNewItem(){
for (let i=0; i<4; i++){
$w(orderItem[i]).expand;
}
//each time a member presses the button I want a strip to expand…
if ($w(orderItem[4]).visible){
$w(“#addItemButton”).disable;
$w(“#itemLimitError”).expand;
}
//…until all 5 strips are visible, then they can’t add anymore items and a text box expands
else {
$w(“#addItemButton”).enable;
}
}
Nothing happens when I press the button. I am pretty new to coding so I don’t know if the array is really the best option for what I am trying to achieve.
Also I seem to have an issue with the collapse property. I’ve marked strips as collapsed when the page loads yet the page is still just as long with empty space where the collapsed strips are. The strips are parents for multiple user input boxes, if these are not marked as collapsed as well, does it cause the issue I am describing?
Anyways, thanks for any help