always use $form->input()
this will make a lot for u automatically

On 11 Mrz., 11:19, SeeVik <[email protected]> wrote:
> Hello all
>
> I am using cakephp 1.2 and I am having problem in displaying the error
> messages for the data validation of a form. I created the form like
> this....
>
> <?php echo $form->create( 'Posts', array( 'action' => 'index' ) ); ?>
> <?php echo $form->text( 'text' ); ?>
> <?php echo $form->text( 'value' ); ?>
> <?php echo $form->end( 'Submit' ); ?>
>
> In my model Post.php
>
> I have defined $validate like this....
>
> $validate = array(
>  'text' => array( 'rule' => 'notEmpty', 'message' => 'This is
> needed' ),
>  'value' => array( 'rule' => 'notEmpty', 'message' => 'This is
> needed' )
> );
>
> In my PostsController.php I did the validation like this...
>
> function index() {
>  if( $this->data ) {
>    $this->Post->set( $this->data );
>    if( $this->Post->validates() ) {
>       // some action here
>    }
>    else {
>    // other action here
>    }
>    $this->set( 'check', $this->Post->validationErrors );
>
> So when I see the variable "check" in my view, I can see the messages
> I defined in my model. But I cannot see the error message below my
> text fields in the view. Why is that? What am I doing wrong over here?
>
> Thanks and Regards
> ShiVik

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