Roll it back to a previous version if you don't like this one...

Wayne

On 10/30/07, senser <[EMAIL PROTECTED]> wrote:
>
> I've read that the correct way is  to set error messages in layouts,
> but not in models.
> But even if I use a code like this:
>
> 'reminder'=>array( array('required'=>false),
>                                     array('allowEmpty'=>true),
>                                     array('rule'=>array('date', 
> 'format'=>'ymd'),
> 'message'=>'Invalid date format'),
>                                     array('rule'=>array('between', 10, 10), 
> 'message'=>'Length is
> 10 symbols'),
>                                     array('rule'=>array('validReminderDate'), 
> 'message'=>'Date
> can not be in the past'))
>
> I still get an error "Error in field Reminder" when the field is
> replete correctly.
>
>
> P.S. I'm terribly sorry that I upgraded to this new version of CakePHP
> - I've already been trying correct my code for two days - buttons has
> gone away (http://groups.google.com/group/cake-php/browse_thread/
> thread/53731efd48b0c4b/ef2d193a5c0ae668?lnk=gst&q=button
> +1.2.0.5875#ef2d193a5c0ae668), validation rules are broken .........
> and who knows what else
>
> On Oct 30, 12:28 am, francky06l <[EMAIL PROTECTED]> wrote:
> > Well to receive a different message, you need to associate message
> > into your rule or in your view :
> >
> >                                         array('rule'=>array('between',
> > 10, 10), 'message' => "invalid range"),
> >
> > I use the cake1.2 branch
> > cheers
> >
> > On Oct 29, 3:28 pm, senser <[EMAIL PROTECTED]> wrote:
> >
> > > I've chaged the code in my Model in this way:
> >
> > > var $validate=array('reminder'=>array( 'required'=>false,
> > >                                         'allowEmpty'=>true,
> > >                                         'rule'=>array('date', 
> > > 'format'=>'ymd'),
> > >                                         'rule'=>array('between', 10, 10),
> > >                                         
> > > 'rule'=>array('validReminderDate')));
> >
> > > Now thigs seems to work but I cannot set different
> > > valdiaton_error_messages - for any validation rule i receive "This
> > > field cannot be left blank" when the field is invalid. Here is a part
> > > of my  view:
> >
> > > print $form->input('Comment.reminder', array('type'=>'text',
> > > 'length'=>10, 'maxlength'=>10,
> > >                                                                         
> > > 'error'=>array('date'=>'Invalid date format',
> > > 'length'=>'Length is 10 symbols', 'valid_date'=>'Date can not be in
> > > the past')));
> >
> > > On Oct 29, 4:01 pm, francky06l <[EMAIL PROTECTED]> wrote:
> >
> > > > Sorry did not read the complete code, but I have something like this
> > > > that works :
> >
> > > >                           'email'           =>
> > > > array(array('allowEmpty' => true,
> > > >                                                            'rule' =>
> > > > 'checkEmails'))
> >
> > > > On Oct 29, 2:54 pm, senser <[EMAIL PROTECTED]> wrote:
> >
> > > > > Hi,
> >
> > > > > After upgrading to CakePHP 1.2.0.5875 from 1.2.0.5427 I can't set
> > > > > validation for form fields that are NO obligatory. Untill now I used
> > > > > this code ana everything seemed to work fine:
> >
> > > > > /********MODEL SNIPPET************/
> > > > > var
> > > > > $validate=array('reminder'=>array( 
> > > > > 'required'=>array('rule'=>array('required'=>false)),
> > > > >                                                                       
> > > > >   'allow_empty'=>array('rule'=>array('allowEmpty'=>true)),
> > > > >                                                                       
> > > > >   'date'=>array('rule'=>array('date', 'format'=>'ymd')),
> > > > >                                                                       
> > > > >   'length'=>array('rule'=>array('between', 10, 10)),
> > > > >                                                                       
> > > > >   'valid_date'=>array('rule'=>array('validReminderDate')));
> > > > > /********************************/
> > > > >  The idea was if user doesn't enter reminder date and validation of
> > > > > this field passes, but if he enters some values field must be
> > > > > validated as a valid date in the future (this is the custom validation
> > > > > rule called validReminderDate). This worked fine for me with previous
> > > > > version, but now if the reminder_field is left blank the form doesn't
> > > > > validate.
> >
> > > > > I have read all the topics in GoogleGroups relevant to this bu I
> > > > > didn't find a 
> > > > > solution:http://groups.google.com/group/cake-php/search?group=cake-php&q=allow......
> >
> > > > > The theme is discussed many times but still doesn't have safe and
> > > > > hopeful cakephp_native solution ..... or may be I miss something.
> >
> > > > > I'm really stuck with this validation problem.
> >
> > > > > Give me some help pls.
> >
> > > > > P.S.
> > > > > Set::filter is not a solution  - if user doesn't fill obligatory field
> > > > > filter deletes the name of the field from array and that breaks
> > > > > validation. And allowEmpty rule is only enforced when there is an
> > > > > actual fieldName index in the data array.
> > > > > I even tried to set empty fields to NULL in beforeValidate but no
> > > > > success again
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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