@John

You're right, I went back and looked and I was indeed using $form->input()
on the earlier forms. I understand that $form->input has a bit of
"automagic" that comes along with it but I honestly never would have never
given a second thought that $form->select() wouldn't be so concerned with
validation. My forms aren't just a select fields, they are a mixed bag of
all kinds of elements (would that make a diff?) although none are using
$form->input() at this point. I'm not sure why I switched to coding the form
elements differently in the first place, I guess I figured that if there's a
specific tag available for the job, why not use it? It says right in the
book under the form helper description "FormHelper focuses on creating forms
quickly, in a way that will streamline validation, re-population and
layout". I had my sights set on the part about streamlining validation but
then again, it does validate.

Since they are both form helpers what would make the difference of why one
displays the errors and the other don't? They both re-populate and do
everything else they are supposed to. I would imagine that if you didn't
want the message you could just omit 'message' => from the validation in the
model. If what you're saying is indeed correct then I don't feel entirely
foolish over this one. It would be very misleading to have some form helpers
display the messages while others don't and not have that clearly defined in
the book (or am I missing that part?).

Thanks John

- Ed

On Sun, May 23, 2010 at 7:35 AM, John Andersen <[email protected]>wrote:

> Just for my own curiosity, I tried to implement your setup, and it is
> correct, the select will be validated, but the error message will not
> be displayed.
>
> The reason may be that you are using:
>
> $form->select('ProfileAttribute.gender', array('M' => 'Male', 'F' =>
> 'Female'), false, array('empty' => 'Please choose'));
>
> instead of:
>
> $form->input('ProfileAttribute.gender', array('empty' => 'Please
> choose'));
>
> where the last gets the option values from the controller set method.
>
> Browsing through the form helper code, it seems to me, that the form
> helper method select, does not concern itself with errors returned
> from the validation. On the other hand, the form helper method input
> does so.
>
> Maybe you should consult your other code samples and confirm that you
> are using the $form->select() and not the $form->input() to display
> the select field!
> Enjoy,
>    John
>
>
>
> On May 23, 9:30 am, Ed Propsner <[email protected]> wrote:
> > It worked just fine to pull the errors out of the array and display them
> > manually, it was just more coding than I would have liked.
> > I was more interested in finding out what caused the problem in the first
> > place more than I was finding an 'alternative' for validation and
> displaying
> > errors.
> >
> > Honestly, I'm over it 8-) The forms are all done and working.
> > If I find out what the problem is now it would probably just make me want
> to
> > drop kick my computer because the solution always ends up being something
> > ridiculously simple staring me in the face the whole time. It's the
> nature
> > of the beast 8-)
> >
> [snip]
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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