|
Hi,
I'd like to search duplicates in the database before submit the form. The
question is how can I pass _javascript_ variables to a SQL query. CF complaints
(variable y is not defined) if I use it directly:
y = document.AddNewItem;
// search existing items in whole database <CFQUERY NAME="qSearchDuplicates" DATASOURCE="#request.app.dsn#" BLOCKFACTOR="100"> SELECT HardwareAddr,IPAddr,SERIALNUMBER,ASSETNUMBER FROM tblPrinter_inventory WHERE <CFIF y.ASSETNUMBER.value IS NOT ""> AND (tblPrinter_inventory.ASSETNUMBER = 'y.ASSETNUMBER.value') </CFIF> <CFIF y.HardwareAddr.value IS NOT ""> AND (tblPrinter_inventory.HardwareAddr = 'y.HardwareAddr.value') </CFIF> <CFIF y.IPAddr.value IS NOT ""> AND (tblPrinter_inventory.IPAddr = 'y.IPAddr.value') </CFIF> <CFIF y.SERIALNUMBER.value IS NOT ""> AND (tblPrinter_inventory.SERIALNUMBER = 'y.SERIALNUMBER.value') </CFIF> </CFQUERY> if (qSearchDuplicates.recordcount == 0) { y.submit(); } else { alert("Printer with the same either Hardware or IP Address, Serial or Asset number already exists in the Inventory database.\n\nPlease check the details and try again."); return false } Thanks,
George
---You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia http://www.mxdu.com/ + 24-25 February, 2004 AMES (Adult Multicultural Education Services) www.ames.net.au Disclaimer ********************************************************************** This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments you should check them for viruses or defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of Adult Multicultural Education Services (AMES). ********************************************************************** --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia http://www.mxdu.com/ + 24-25 February, 2004 |
