I posted this a few months ago, but never got colution, so i will try one
more time :)
Hopefully someone will be able to help me on this.
I have a zend_dojo WORKING form, but checkbox validation wont work.
I'b been told to try this:
--------------------------------------------------------------------------
<? $this->dojo()->javascriptCaptureStart() ?>
dojo.addOnLoad(function () {
    dojo.connect(dijit.byId("signup"), "onSubmit", "validateForm");
});


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

This wont work :)

However, in my controller i have this:
--------------------------------------------------------------------------------------------------
$agreements->addElement('CheckBox', 'ages', array ( 
           'checked' => 'checked' , 'required' => true , 'label' => 'I\'m
Over 18 years old' 
        ))->addElement('CheckBox', 'promotions', array ( 
            'checked' => 'checked' , 'required' => true , 'label' => 'I
agree NOT to send any email promotions promoting this web site' ,
'invalidMessage' => 'You must validate that you are over 18' 
        ))->addElement('CheckBox', 'terms', array ( 
            'checked' => 'checked' , 'required' => true , 'label' => 'I
agree to the Terms & Conditions' , 'invalidMessage' => 'You must validate
that you are over 18' 
        ))->addElement('SubmitButton', 'submit', array ( 
            'label' => 'Submit!' , 'style' => 'clear:both' 
        ));
--------------------------------------------------------------------------------------------------

The other part of form is not relevant for my question. There are some
fields for name, username, password etc...
SO...
Whatever i am doing, validation of those checkboxes wont work, and if i
UNCHECK them, my form submit proceed. This should not be happen. 
Is there anyone in zend comunity who can help me to solve this? Not just to
drop some solution and then never look back if that helps, but to watch this
topic and my response on it? Please? :)
I am solving this for a moths...
Thanks,
V
-- 
View this message in context: 
http://www.nabble.com/Zend_Dojo-CheckBox-validation-tp21690246p21690246.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to