Hi,
I have 2 problems
1. I have a dropdown menu that gets the energy suppliers (developers) from a database which a corresponding price in another column (price). My problem is how can update a textbox with the corresponding price of the selected dropdown value?
Here's my input fields:
And here's the database where the values would be referred:
2. My second problem is, when a user inputs all the field, I want to calculate the user input into a text field that'll show how much a user has to pay he uses clean energy. Here's my calculation formula:
Kilowatt usage x price + admin fee (.01 x kilowatt usage) = total price
Here's sample screenshot of the input fields:
I am new to wix and have very minimal jquery skills, so any detailed would really be appreciated.
Many thanks,
Kev
She has the link in her YouTube description. i referred to that code
@poolshark314 could you tell me what it would look like if I had two different fields as conditions to display the text (among which one dropdown whare I removed duplicate entries with the appropriate coding). Both fields are a dropdown (#dorpdown4, period1) and a text field (#text4, entity) in a dynamic page:
i believe this code is not the correct one:
export function dropdown3_change(event, $w) { let dropdownvalue = $w('#dropdown3').value; $w('#text4').text; $w('#dataset1').setFilter(wixData.filter().eq("period1","entity", dropdownvalue)) }
thanks and regards
Dear Kevin, have exactly the same request. Were you able to solve it? thanks
For #1
You will need 2 copies of that same dataset that connect to your dropdown: 1 that will actually provide the dropdown choices, and the other that does the actual filter, connected to the textbox to update it. If you connect the same dataset to both the dropdown and textbox, it will only work 1 time and then the filter will apply to the dropdown and only provide you with the option you selected first. Click the Connect to Data icon on the textbox and connect it to the price field. Click the Connect to Data icon on the dropdown menu and use the bottom section to display your dropdown items. Then create an onchange action for the dropdown in the properties menu. Your code should look similar to this, replacing:
dropdown_change - the name of your dropdown onchange action
#dropdown - the name of your dropdown
#dataset1 - the name of the dataset connected to your textbox
field - the name of the field in your collection (the field displayed in your dropdown)
export function dropdown_change() { let dropdownvalue = $w('#dropdown').value; $w('#dataset1').setFilter(wixData.filter().eq("field", dropdownvalue)) }