Hello all,
is anyone here able to help about form validation please?
After pressing submit button expected behaviour is stopping form submission
if checkbox is not checked.

I have a bunch of stuffs in my form.
So far, checkbox validation wont work. 
$agreements->addElement ( 'CheckBox', 'ages', array ('required' => true,
'label' => 'I\'m Over 18 years old') )

Submit button:
$footer->addElement ( 'SubmitButton', 'submit', array ('label' =>
'Submit!','style'=>'clear:both' ) );

view script:
<? $this->dojo()->javascriptCaptureStart() ?>
function validateForm() {
    var form = dijit.byId("signup");
    if (!form.validate()) {
        alert("Invalid form");
        return false;
    }
    return true;
}
<? $this->dojo()->javascriptCaptureEnd() ?>
<? $this->dojo()->onLoadCaptureStart() ?>
function () {
    dojo.connect(dijit.byId("signup"), "onSubmit", "validateForm");
}
<? $this->dojo()->onLoadCaptureEnd() ?>
<div class="signupForm">

<?= $this->form ?>
</div>
-- 
View this message in context: 
http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-tp19512338p19512338.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to