Hey kaushik, I wrote the validation helper that you're using (at least I'm guessing it's the same one).
I don't think "allowEmpty" is a rule. If you look at the Cookbook (http://book.cakephp.org/view/134/Built-in-Validation-Rules) it's not listed (although it may just not be updated). I think "allowEmpty" is a key on the same level as "rule" (http://book.cakephp.org/view/127/ One-Rule-Per-Field). The rule you want looks to be "notEmpty" although there is a warning that that doesn't work on multiples... Having said all that I'm pretty sure the helper doesn't handle checkboxes correctly. jQuery's .val() returns the value of the checkbox, not whether it's checked or not. The helper needs to be updated to check the input type and handle appropriately. I'll try to take a look at this the next few days. Keep an eye on the GitHub repo (http://github.com/mcurry/cakephp/tree/master/helpers/validation). Patches are always welcome as well :) -Matt http://www.pseudocoder.com On Mar 3, 7:10 am, kaushik <[email protected]> wrote: > I am using Automatic JavaScript Validation. For a mandatory select > box, i am using the following code: > var $validate = array( > 'blogCategoryId' => array( > 'required' => array('rule' =>array > ('allowEmpty',false), 'message'=>'Please select Blog > Category.'), > ), > ); > > But it is not working. Please anyone can help me. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
