Hello,
I am trying to run a conditional that checks the value of a field from a DB when the window loads and in turn checks or unchecks a checkbox depending on whether the value is “YES” or “NO”. I’ve tried to focus on the field within the global onload event as i have seen online, but thats not working. What could i be doing wrong?
[code]
window.onload = function() {
document.Customer.Customer_Sub.focus();
if (document.Customer.Customer_Sub.value = “” || document.Customer.Customer_Sub.value = “YES”) {
document.Customer.chkbox.checked;
document.Customer.Customer_Sub.value = “YES”;
}
}
I have working code that changes the value of “Customer_Sub” cooresponding to the status of the checkbox (chkbox), and I am correctly reading the value in the database if there is an existing session loading the window.
My problem lies with tying it to the checkbox as well as making it default to checked and “YES”, all when the window loads.