Friday, March 26, 2010

Re: Radio button error message not showing up

Use $form->input() instead of $form->radio() or use $form->error()
together with $form->radio()

On Mar 27, 1:05 am, aapljack <brianmiddle...@gmail.com> wrote:
> I am building a form with a set of radio buttons and am failing to get
> any kind of error message when they don't pass the validation.
>
> Here is the model code I have for validation..
>
> var $validate = array(
>                 'name' => array(
>                         'rule' => 'notEmpty',
>                                 'message' => 'Name is required'
>                 ),
>                 'email' => array(
>                         'rule' => 'email',
>                         'message' => 'A valid email address is required'
>                 ),
>                         'services' => array(
>                                 'rule' => 'notEmpty',
>                                 'allowEmpty' => false,
>                                 'message' => 'Select a service'
>                         )
>             );
>
> The 'Services' are the radio buttons I am validating.
>
> Here is the code for the view for the 'Services' radio buttons. These
> were taken from an example and not changed. Trying to get them to work
> first..
>
>   $options = array('M'=>'Male','F'=>'Female');
>   $attributes = array('legend'=>true);
>   echo $form->radio('Contest.services',$options,$attributes);
>
> The form seems to be validating the radio buttons, but it will not
> give me an error message on the page.
>
> Any ideas?
>
> Thanks!
>
> Brian

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

No comments: