Image

Image_elioclya_ wrote in Imagephp

Checkbox unchecked alert? - solved!

Hi there,

I have a sign up form which is working perfectly except for one thing; no matter how I phrase it, I cannot get an alert to display when a checkbox is unchecked. The code works perfectly for the textboxes that use it, but the checkbox won't behave. Is there a fundamental difference I'm missing here?

Here's two examples from the form; the company name part is working fine, but the terms simply won't register an alert.

Company Name: (*) 
                
            <input type=text name="company" style="width:200px" id="company" size=44 value="<?php echo get_param("company");?>">


Please tick this box to confirm that you accept our terms and conditions. <input type="checkbox" name="terms" id="terms" value="yes">


function ValidateSignupForm(x){
            if(x.company.value==""){
                alert("<?php echo $ENTER_COMPANY_NAME;?>");
                x.company.focus();
                return false;
            }   
            if(x.terms.value==""){
                alert("You must agree to our terms and conditions in order to join.");
                x.terms.focus();
                return false;
            }


Any thoughts would be greatly appreciated. Thank you in advance.

Solved! Thanks to luminairex and cyclotron!