Hi,
I’m sorry, but I don’t understand the structure of your records. What are the values per passenger, or how are used these values in the final equation?
Based on your explanation you need a drop down field with the list of suburb, and another drop down field with numbers from 1 to 12.
By the way what version of the plugin are you using?
Best regards.
Sorry if I didn’t express correctly … what i am trying to do is based on suburb i would like to choose the number of passengers I am collecting so the for should be EG
Choose a suburb ( which selects a set of records )
Then choose the number of passengers ( which will select one record)
which will display the cost.
Suburb | P1 | p2 | p3 | p4 | p5| etc
Sydney | $55 | $60 | $80 | $100 |
Liverpool | 45 | 50 | 60 | 80 |
Parramatta | 70 | 80 | 90 | 110 |
Because each suburb has different pricing for passengers. I need the customer to select the suburb then choose how many passengers to show them the cost.
Hope that helps.
Hi,
In this case you can define a javascript object as database, and use the values of the dropdown fields as selectors, for example:
1. Insert a dropdown field for suburbs, I will call it fieldname1, with the choices (texts and values):
Sydney
Liverpool
Parramatta
2. Insert a second dropdown field for persons, I will call it fieldname2, with the choices (texts and values):
1
2
3
4
3. To use the object with the data from different equations in the form I’ll use an separated field. Insert a “HTML Content” field with the piece of code below to generate the literal object:
<script>
database = {
'Sydney':[55,60,80,100],
'Liverpool':[45,50,60,80],
'Parramatta':[70,80,90,100]
};
</script>
4. Finally, insert a calculated field whose equation would be as simple as:
database[fieldname1][fieldname2*1-1]
and that’s all.
Tip: Javascript is a case sensitive language, pay attention to the suburbs names in both places: the dropdown field and the object.
Best regards.
Thank you that worked , so I wont use MySQL database and use the script instead all good. Cheers.