Hello -
I have several select boxes on an app page that allow the user to make selections in order to narrow down what is returned from a database query. I have an if-then javascript load some local storage variables based on the select boxes.
This works fine until a select box is left at the default "All" selection, in which case I want to have no filtering for that particular field. In the JS, I have the local storage set to nothing, or "" in the code. What should I use instead to get this functional?
Thanks!!
Part of the if-then JS for reference:
var selectvoltage = Appery('select_voltage').val();
if (selectvoltage == "0")
{
localStorage.setItem('localselectvoltage', ""); //nothing selected - default all
}
else if (selectvoltage == "1")
{
localStorage.setItem('localselectvoltage', "12"); //12VDC
}
else if (selectvoltage == "2")
{
localStorage.setItem('localselectvoltage', "24"); //24VDC
}
Database Request JS for reference:
var getvolume = localStorage.getItem('localselectvolume');
var getvoltage = localStorage.getItem('localselectvoltage');
return '{"PG2":"'+getvolume+'", "INPUT_VOLTAGE":"'+getvoltage+'"}';