A question about has cookies.
If I set a Hash Cookie like this:
and the variable SQLSEARCH does NOT exist on the current form and I then try to reference this has cookie on a form that I call, can I reference this hash cookie? How do I reference this hash cookie in the subsequent form that I called?
For example: I tried just using a JavaScript alert:
Code: Select all
alert('Search Form SQL='+$('#SQLSEARCH').val());
alert('Search Form SQL='+$('#SQLSEARCH'));
alert('Search Form SQL='+'#SQLSEARCH#');
I tried all three of these and got undefined on the first two and just a text string 'Search Form SQL=#SQLSEARCH#' on the last one.
In my example I have a launch form with the fields FRM_lastname and FRM_firstname on them. I also have a button btn_SEARCH on this form. In the Javascript (Custom Code) I have:
Code: Select all
if ($('#FRM_lastname').val() != "") {
sql = sql + 'AND TaxCustomers.cust_lastname LIKE ' + $('#FRM_lastname').val() +'%';
}
if ($('#FRM_firstname').val() != "") {
sql= sql + ' AND TaxCustomers.cust_firstname LIKE ' + $('#FRM_firstname').val()+'%';
}
If I do an alert using the sql variable. It displays the correct text.
If I do an alert AFTER this assignment:
Code: Select all
nuSetProperty('SQLSEARCH', sql);
alert('MGMT Form SQL='+$('#SQLSEARCH').val());
I get undefined for the $('#SQLSEARCH').val().
Why? AM I not referencing the SQLSEARCH Variable correctly or since that doesn't exist on the form I can't set it and pass it?
Also, I tested further with this:
Code: Select all
var lastname = $('#FRM_lastname').val();
var firstname = $('#FRM_firstname').val();
var sql = '';
if (lastname != "") {
sql = sql + 'AND TaxCustomers.cust_lastname LIKE ' + lastname +'%';
}
if (firstname != "") {
sql= sql + ' AND TaxCustomers.cust_firstname LIKE ' + firstname +'%';
}
nuSetProperty('FRM_lname', lastname);
nuSetProperty('FRM_fname', firstname);
I get the same undefined results when trying to use the FRM_lname or FRM_fname variables. HOWEVER if I change those to be FRM_lastname and FRM_firstname in the nuSetProperty above and then use those variables in the next form that I call, it works without any issues. So this makes me think I have to have the field ON the form before I can use the nuSetProperty command. Is this correct? If yes, How can I pass along the "SQLSEARCH" variable text to the next form? Can I set a hidden field on the launch form name SQLSEARCH and then use that on the called form?