The issue seems to be when the addshield_yn checkbox doesnot appear (is not defined) in the form... it doesn't process any of the other if statements below it.
Code:
<script language="javascript" type="text/javascript">
function validatechars() {
if(document.form_add.addbranding_yn.checked == true && document.form_add.addshield_yn.checked == true) {
alert("You cannot select both custom branding and shield pro on this shaft. \nPlease remove one and try again.");
return false;}
if(document.form_add.addbranding_yn.checked == true && document.form_add.branding.value.length < 1) {
alert("You selected branding but did not type in your custom brand. \nPlease either unselect branding or type in your custom brand and try again.");
return false; }
if(document.form_add.addbranding2_yn.checked == true && document.form_add.branding2.value.length < 1) {
alert("You selected individual branding but did not type in your custom brand. \nPlease either unselect individual branding or type in your custom brand and try again.");
return false;}
var iChars = "!@$%^&*()+=[]\\\;/{}|\":<>?";
if (document.form_add.branding.value.length > 0) {
for (var i = 0; i < document.form_add.branding.value.length; i++) {
if (iChars.indexOf(document.form_add.branding.value.charAt(i)) != -1) {
alert("Your custom brand has invalid special characters. \nPlease remove them and try again.");
return false;
}
}
}
if (document.form_add.branding2.value.length > 0) {
for (var i = 0; i < document.form_add.branding2.value.length; i++) {
if (iChars.indexOf(document.form_add.branding2.value.charAt(i)) != -1) {
alert("Your team list has invalid special characters. \nPlease remove them and try again.");
return false;
}
}
}
}
</script>
Bookmarks