I think I did something wrong in my implementation of your very detailed "Locking the Submit button until the box is checked"
This is my setting for the forms checkbox:
Field Name: input_checkbox_14
The form code for it turns out as this:
<div class="ccms_form_element cfdiv_checkbox" id="i_agree_to_the_terms_container_div"><input value="1" type="checkbox" class="validate['required'] label_right" name="input_checkbox_14" />
<label class="full_label">I agree to the terms</label><div class="clear"></div>
These are my settings for the form submit button:
Name: input_submit_4
ID: submit
Text: Submit
The form code for it turns out as this:
<div class="ccms_form_element cfdiv_submit" id="input_submit_4_container_div"><input name="input_submit_4" id="submit" class="" value="Submit" type="submit" />
<div class="clear"></div>
This is my form events setup:
[attachment=0]cf4_form-events_setup.JPG[/attachment]
The ONLOAD -> Load JS looks like this:
// stop the code executing
// until the page is loaded in the browser
window.addEvent('load', function() {
// function to enable and disable the submit button
function agree() {
if ( $('input_checkbox_14').checked == true ) {
$('submit').disabled = false;
} else {
$('submit').disabled = true;
}
};
// disable the submit button on load
$('submit').disabled = true;
//execute the function when the checkbox is clicked
$('input_checkbox_14').addEvent('click', agree);
});
and the Custom Server Side Validation looks like this:
<span class="syntaxdefault"><?php<br />$agree </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> JRequest</span><span class="syntaxkeyword">::</span><span class="syntaxdefault">getString</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'input_checkbox_14'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'empty'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'post'</span><span class="syntaxkeyword">);<br /></span><span class="syntaxdefault">if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> $agree </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> </span><span class="syntaxstring">'empty'</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault">  return </span><span class="syntaxstring">'Please check the box to confirm your agreement'</span><span class="syntaxkeyword">;}<br /></span><span class="syntaxdefault">?></span>
The end result of all of this, is that the Submit button is greyed out and clicking the checkbox DOESN'T activate the Submit button.
Also I get this error in Firebugs console panel from /localhost/component/chronoforms/?chronoform=Register:
$("input_checkbox_14") is null
The breakpoint points to the $('submit') line:
// disable the submit button on load
$('submit').disabled = true;