JavaScript help onClick event
450042Feb 20 2006 — edited Feb 20 2006Version 2.0
I'm trying to create an onClick function that will populate fields when a check box is clicked.
I have a company name, contact name, address, city, state, zip, and phone. I have a checkbox labeled "Bill Same As Vendor". When this check box is clicked I would like the above values in these fields to be copied to the corresponding fields in my "Billing" section and those same fields to be "nulled" when the checkbox is deselected.
I have put this in the HTML Table Cell Attributes section of my checkbox: onClick="copy_address()"
I have this function in the HTML Header section of the page attributes section:
< script language="JavaScript" type="text/javascript" >
< !--
htmldb_delete_message='"DELETE_CONFIRM_MSG"';
function copy_address()
{
if (:P1_BILL_SAME_AS_VENDOR == 1)
{
:P1_BILL_COMPANY = :P1_VENDOR_NAME;
:P1_BILL_ATTENTION = :P1_VENDOR_CONTACT_NAME;
:P1_BILL_ADDRESS = :P1_VENDOR_ADDRESS;
:P1_BILL_CITY = :P1_VENDOR_CITY;
:P1_VENDOR_STATE = :P1_BILL_STATE;
:P1_BILL_ZIP = :P1_VENDOR_ZIP;
:P1_BILL_PHONE = :P1_VENDOR_CONTACT_PHONE;
}
else
{
:P1_BILL_COMPANY = NULL;
:P1_BILL_ATTENTION = NULL;
:P1_BILL_ADDRESS = NULL;
:P1_BILL_CITY = NULL;
:P1_VENDOR_STATE = NULL;
:P1_BILL_ZIP = NULL;
:P1_BILL_PHONE = NULL;
}
}
// -->
< /script >
I'm getting a syntax error when running the page. Unfortunately, I can only use IE and I'm not allowed to install FireFox.
Can someone help me with this?
Thanks,
Joe