goluhaque:

If I'm reading your code correctly, your Post model has a validation
rule on a fieldName 'post' that must be at least one character in
length and is required (although the rule name 'minLenght' is
misspelled).  However, the form defined in your view does not have an
input for this field, which means:

1) $this->data['Post']['post'] will never be defined by the time you
execute this->Post->save(), UNLESS you have defined a default value
for the 'post' field when you created the table.

and

2) the validation error 'Question cannot be empty' will never display
when the form is rendered again.  (Field validation errors are
automatically displayed with the corresponding input() if you create
your forms using the FormHelper).

To verify, try adding the following lines in the ELSE block (where you
execute $this->Session->setFlash(__('Post user id Could not be saved',
true));
):

  Configure::write('debug', 2);
  debug($this->Post->validationErrors);


and check the value displayed in the debug block on the rendered page.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to