Hello, I am trying to create a online quote tool depending on what the user selects. dropdown1 is a list of products. When you select the product it displays a picture of the product and also the price in a textbox plus the monthly cost in another textbox for a 24 month period. My 2nd dropdown2 is where they can select an offered plan and the 3rd dropdown3 they can select the number of devices on that plan. So with dropdown 2 and dropdown3 they need to work together to get me the result I need from my dataset. So if I select Plan1 and then 2 it needs to display the number in Plan1 row 2 of my dataset and then display that result in a textbox.
Here is some code I have as of now. This does not include the 3rd dropdown3 as I am stumped now.
export function dropdown1_change(event, $w) {
const indexOfItem = event.target.selectedIndex;
$w(‘#dataset1’).getItems(indexOfItem, 1)
.then((results) => {
let yourItem = results.items; // yourItem is an Array type
$w(‘#image2’).src = yourItem[0].photo; // Should be placed in 0 index position
$w(‘#text2’).text = $${yourItem[0].csDppMax}
;
$w(‘#text3’).text = $${yourItem[0].dppMaxMonthlyPrice}
;
$w(‘#text19’).text = $${yourItem[0].dppMaxMonthlyPrice}
;
});
}
export function dropdown2_change(event, $w) {
const indexOfItem = event.target.selectedIndex;
$w(‘#dataset2’).getItems(indexOfItem, 1)
.then((results) => {
let yourItem = results.items; // yourItem is an Array type
$w(‘#text7’).text = $${yourItem[0].line1}
;
});
}