I am continuing a project. And this is the only thing I do not understand. It is the key function for assembling a filter string to be used for sql query. This function is invoke via onclick of a button.
My problem is the value for query is taken from $_REQUEST['FILTER'].
<input id="HDN_FILTER" name="FILTER" type="hidden" value="<?php echo $_REQUEST['FILTER']; ?>">
At first $_REQUEST['FILTER'] is empty. Then upon pressing the submit button it assembles and return the string. But I don't understand how it assembled the string. Because it seems the function get its value from this input. But it's value is empty. So the function should received empty from this input. It's like going in circles
Example what does "" != means in javascipt anyway?
An example of the assembled string is ""DELIVER_STORE_ACCOUNT=ALL^STORES_ACCOUNT=ALL^ACTIVE=1^PART_NUMBER=ALL^NEW_PART_NUMBER=ALL""
And I see the join("^") part in the function. And it seems this line assembles it. But why is it inside a switch parenthesis?
function SUBMIT(e, t) {
array_Filter = new Array;
for (i in array_Dropdown) {
if (varField = array_Dropdown[i], varID = "SEL_" + varField, aryTemp = new Array, -1 != document.getElementById(varID).selectedIndex)
for (i = 0; i < document.getElementById(varID).options.length; i++)
document.getElementById(varID).options[i].selected === !0 && (aryTemp[aryTemp.length] = document.getElementById(varID).options[i].value);
aryTemp.length > 0 && (array_Filter[varField] = aryTemp)
}
"" != document.getElementById("HDN_SEARCH").value && (aryTemp.SEARCH = document.getElementById("HDN_SEARCH").value), array_Filter_Temp = new Array;
for (i in array_Filter)
array_Filter_Temp[array_Filter_Temp.length] = i + "=" + array_Filter[i].join("|");
switch (varFilter = array_Filter_Temp.join("^"), document.getElementById("HDN_FILTER").value = varFilter, document.getElementById("HDN_EXCEL").value = 1 == e ? 1 : 0, !0) {
case 1 == t:
document.getElementById("HDN_OVERRIDE").value = 1;
break;
case 0 == t:
document.getElementById("HDN_OVERRIDE").value = 0;
break;
case-1 == t:
}
varTXTBOX = document.getElementById("TXT_SEARCH").value;
alert(varTXTBOX);
document.getElementById("FORM1").submit()
}
'' !=it's comparing something with an empty string"" != document.getElementById("HDN_SEARCH").value && (aryTemp.SEARCH = document.getElementById("HDN_SEARCH").value)neither creating andifstatement and then he create again the same global scope variable ofarray_Filter_Temp = new Array;you could remove those line and will nothing happen