OK, So the validation messages are displaying, but they are displaying
the whole time regardless of whether or not they should be...

Now I'm not so sure I'm accessing the fields properly at all....

Any suggestions?

On Jul 1, 11:53 am, number9 <[email protected]> wrote:
> Well I've got the validation message to display now, it works but
> feels a bit hacky?
>
> I stored the validation errors array in a variable:
>
> <?php $v_errors = $this->validationErrors; ?>
>
> I then accessed the error for the relevant field names and outputted
> it if there was an error message:
>
> if (isset($v_errors['Post']['Tag.name'])) { echo "<div class=\"error-
> message\">".$v_errors['Post']['Tag.name']."</div>"; }
>
> My guess is that something I did in the controller caused the error
> messages not to display for those particular fields. If anybody would
> like to shed light on this, I would love to hear it!
>
> On Jul 1, 11:21 am, number9 <[email protected]> wrote:
>
>
>
> > OK, so the minute I posted this, I noticed that actually the field
> > names are OK, but the messages are not displaying for those fields.
>
> > Output of <?php pr($this->validationErrors); ?> :
>
> > Array
> > (
> >     [Post] => Array
> >         (
> >             [name] => The name for your tip should be at least 10
> > characters.
> >             [Tag.name] => 10 chars please.
> >         )
>
> > )
>
> > The "name" field error is displayed, but the "Tag.name" fields error
> > isn't...
>
> > On Jul 1, 11:09 am, number9 <[email protected]> wrote:
>
> > > I have a form where users can add tags/images at the same time as
> > > adding a post.
>
> > > These fields are referenced like this in the view:
>
> > > echo $form->input('Img.pic')
> > > echo $form->input('Tag.name')
>
> > > I am trying to add validation rules to these fields in the post model,
> > > referencing the fields as follows:
>
> > >         'Img.pic' => array(
> > >                         // rules etc. go here
> > >                 )
>
> > >         'Tag.name' => array(
> > >                         // rules etc. go here
> > >                 )
>
> > > I have also tried adding validation rules to the Tag model (no Img
> > > model exists because it is a component).
>
> > > How should I be doing this? I have searched but cannot find a
> > > solution. I have tried various validation rules and the rest of the
> > > models validation rules are working fine.
>
> > > Would appreciate any suggestions!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to