Dardo, by all means thanks for your help; please do not apologize for
anything.
That was an error that was actually during copying and pasting to the
bin website; it is in my model as it should be:
var $validate = array(
'title' => array(
'allowEmpty' => false,
'required' => true,
'message' => 'You must enter a title!'
),
);
I apologize for the mistake and appreciate your assistance greatly.
However, even doing scaffolding, I'm still getting the same results.
Quite frustrating as you can imagine. I wish it was as simple as a
typo but it doesn't appear to be the case.
On May 25, 6:38 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> Hi, I was out so this took long
>
> >http://bin.cakephp.org/saved/32683
> >http://bin.cakephp.org/saved/32684
> >http://bin.cakephp.org/saved/32686
>
> I see, the problem is in the model. You must define validations using
> an array in the form 'field' => validationRules
>
> var $validate = array(
> 'title' => array(
> 'rule' => array( 'minLength' , 8 ),
> 'allowEmpty' => false,
> 'message' => 'You must enter a post title!',
> 'required' => true
> )
> );
>
> Check the validation section in the
> manualhttp://manual.cakephp.org/view/125/data-validation
>
> > Cake version 1.2, PHP 5.2.3
>
> And with cake version I meant: 1.2 rev XXXX or alpha/pre-beta/beta.
>
> HTH,
> - Dardo Sordi.
>
> > On May 25, 1:39 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> >> Can you post your controller, model and view code
> >> (inhttp://bin.cakephp.org) and your Cake and PHP versions?
>
> >> On Sun, May 25, 2008 at 3:20 PM, timtrice <[EMAIL PROTECTED]> wrote:
>
> >> > It is not passing validation. In my controller action all I have is a
> >> > simple "if $this->data is saved go back to the index page, otherwise
> >> > flash a message". debug is set to 3.
>
> >> > running debug($this->Post->validationErrors) produces an empty array
> >> > with/without required set to true.
>
> >> > On May 25, 1:06 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> >> >> Is the form passing or failing validation? hint:
> >> >> debug($this->Post->validationErrors);
>
> >> >> Try adding 'required' => true to the validation array and remove
> >> >> $form->error() from your view, that is done by the input method
> >> >> itself.
>
> >> >> HTH,
> >> >> - Dardo Sordi.
>
> >> >> On Sun, May 25, 2008 at 1:04 PM, timtrice <[EMAIL PROTECTED]> wrote:
>
> >> >> > Blinded looking for a more sophisticated problem. This does solve the
> >> >> > first issue in that now the validation works. However, I still cannot
> >> >> > get the error to appear in the form. I have the error call embedded
> >> >> > in the form but I have tried outside as well:
>
> >> >> > echo $form->create( 'post );
> >> >> > echo $form->error( 'title' );
> >> >> > echo $form->input( 'title' );
> >> >> > echo $form->end( 'Add' );
>
> >> >> > On May 25, 10:38 am, "David Zentgraf" <[EMAIL PROTECTED]> wrote:
> >> >> >> 'mesage' => 'wtf?'
>
> >> >> >> WTF indeed. Spellcheck?
>
> >> >> >> On Sun, May 25, 2008 at 9:45 PM, timtrice <[EMAIL PROTECTED]> wrote:
>
> >> >> >> > Here is my form in the view:
>
> >> >> >> > echo $form->create( 'post );
> >> >> >> > echo $form->input( 'title' );
> >> >> >> > echo $form->end( 'Add' );
>
> >> >> >> > Here is my validation in the post model:
>
> >> >> >> > var $validate = array(
> >> >> >> > 'title' => array(
> >> >> >> > 'rule' => array( 'minLength' , 1 ),
> >> >> >> > 'mesage' => 'wtf?',
> >> >> >> > 'allowEmpty' => false
> >> >> >> > )
> >> >> >> > );
>
> >> >> >> > My 'add' function in the controller goes through the processes of
> >> >> >> > validating $this->data on my own. I've tried using $form->error
> >> >> >> > and
> >> >> >> > $form->isFieldError but nothing is automatically generating the
> >> >> >> > errors
> >> >> >> > if I submit an empty form. I've read all about the data validation
> >> >> >> > and what-not but can't find anything that works like it did in Cake
> >> >> >> > 1.1. Am I missing something?
>
> >> >> >> > What function do I need to add to show these errors and where do I
> >> >> >> > need to add it?
>
> >> >> >> > Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---