I was hoping something like allowEmpty would be implemented soon so i could
really start using 1.2 but, using the latest dev release, i still get 'this
field cannot be left blank' errors even when i set allowEmpty to true. I
tried several variants on the example you give but no dice.

Validating non-required fields and integration of custom functions in the
built in validation would allow me to switch to 1.2 completely. I'll take
the random API changes for granted when i could do that now.

Tijs


GreyCells-2 wrote:
> 
> 
> The way it appears to work now (I'm sure nate will correct me if I'm
> wrong) is to put your error messages in the model. Here is an example
> of an email validation:
> 
> var $validate = array(
>          'email_address' => array( array('allowEmpty' => false
>               ,'message' => 'Invalid email address format or unknown
> domain')
>               , 'rule' => array('email', true)
>       ),
> );
> 
> 
> Note the 'message' element in the array. It will also display the
> second argument of $Model->invalidate('field_name', 'My custom
> message'); if you happen to be doing stuff in $Model->validates()
> 
> Use the $form->input() 'wrapper' and the error messages will be
> rendered automatically without having to call tagErrorMessage i.e.
> this is all you need in your view:
> 
> <?php echo $form->input('email_address', array('class' =>
> 'required'));?>
> 
> 
> 
> On Feb 18, 4:12 am, "gobblez" <[EMAIL PROTECTED]> wrote:
>> Hello, in the latest 1.2 SVN,  I can't get validation to work.  Well,
>> it is working, the empty fields are being flagged as they should be
>> for not meeting cake's regex constants, but my tagErrorMsg definitions
>> aren't spitting out their messages.
>>
>> I did a search, and found it on line 1685 of model.php  What I did, is
>> changed 'This field cannot be left blank' to '1'.  It works now, but
>> I'm thinking maybe tagErrorMsg is used differently now.
>>
>> Here is an example of how I've been using it, and it works when a
>> flagged field is set to '1' instead of that 'this field cannot..."
>> sentence.
>>
>> echo $html->tagErrorMsg('User/username', '<span class="error">Please
>> enter a username.</span><br />');
> 
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/1.2-validation---This-field-cannot-be-left-blank-tf3247151.html#a9029256
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to