<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Simple</title>
<script type="text/javascript">

function showHide()
        {
            if(document.getElementById('Checkbox1').checked)
            {
                submit.disabled=false;
                //document.getElementById('submit').disabled = false;
            }
            else
            {
                submit.disabled=true;
                document.getElementById('submit').disabled = true;
            }
        }


    </script>
</head>

<body><h3>Online Application Checklist</h3>
<p><br /> <br /> Please review the following before proceeding<br /> <br /></p>
<fieldset id="hcad4_4387"> <legend id="hcad4_4387_label">I have read and agree to the Terms of Service</legend> <input id="Checkbox1" onclick="showHide();" type="checkbox" /> <label for="hcad4_4387_0">I Agree</label> </fieldset>
<p><br /> <input id="submit" onclick="location.href='http://www.simpleseparation.ca/index.php?option=com_jforms&amp;view=form&amp;id=7&amp;Itemid=72';" disabled="true"  type="submit" value="Submit" /></p>
</body>
</html>

please help me...
Thanks in advance.

Recommended Answers

All 2 Replies

Right... Line 12 + 17 - variable 'submit' undeclared. You should use the following:

function showHide()
        {
            if(document.getElementById('Checkbox1').checked == true) // If the checkbox is already checked
            {
                document.getElementById('submit').disabled = true;
            }
            else // If the checkbox is not yet checked
            {
                document.getElementById('submit').disabled = false;
            }
        }

And in your form:

<input id="Checkbox1" onclick="showHide(); return true;" type="checkbox" />

If this does not work, perhaps you should alert() the variables you retrieve out of the HTML using getElementById()...

~G

Thanks a lot Graphix.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.