I think I figured it out I had my model file named wrong.

yep that was the problem thanks for the help.

On May 7, 8:16 am, matalina <matal...@gmail.com> wrote:
> arif's sugggestion didn't work either
>
> Dr. Loboto I'm not sure how that will help since the data is saving to
> the database correctly.  When I put in an empty field it saves the
> empty field instead of outputting an error message.  When I put in a
> category name it saves it.
>
> Gwoo #2:  But the data is saving when I have data in there doesn't
> that indicate the form is sending correctly?
>
> Gwoo #1: pr outputs AppModel Object so I'm assuming if it printed
> Category Object then I would have found it.  This seems to be the
> error.  How can I fix this?  Is this an inflection problem with
> category and categories?
>
> Thanks for all the help.
>
> On May 6, 10:56 pm, arif hossen <arifhossen2...@gmail.com> wrote:
>
> > I think it should be:
>
> > <?php
> >  class Category extends AppModel
> >  {
> >      var $name = 'Category';
> >    var $validate = array(
> >      'category' => array(
> >        'rule' => 'alphaNumeric',
> >        'required' => true,
> >        'allowEmpty'=>false
> >      )
> >    );
> >  }
> > ?>
>
> > On Thu, May 7, 2009 at 7:57 AM, Dr. Loboto <drlob...@gmail.com> wrote:
>
> > > Output $this->data in controller and check actual data you try to
> > > save.
>
> > > On May 7, 5:35 am, matalina <matal...@gmail.com> wrote:
> > > > I have tried various combinations for validation still nothing is
> > > > working.
>
> > > > This is my last attempt and it's still not validating an empty field,
> > > > I still get an empty database value (new id no content - instead of an
> > > > error message)
>
> > > > <?php
> > > >   class Category extends AppModel
> > > >   {
> > > >       var $name = 'Category';
>
> > > >     var $validate = array(
> > > >       'category' => array(
> > > >         'rule' => 'alphaNumeric',
> > > >         'required' => true
> > > >       )
> > > >     );
>
> > > >   }
>
> > > > ?>
>
> > > > On May 6, 1:03 pm, matalina <matal...@gmail.com> wrote:
>
> > > > > I followed along with the blog tutorial and got that working with out
> > > > > a problem.  Now I'm modifying the blog tutorial for my own purposes
> > > > > since the basic technique was the same for this particular part of the
> > > > > project but now the fields are not validating.  When I had it as
> > > > > notEmpty it still posted an empty entry to the database.  And with it
> > > > > alphaNumeric it's still posting an empty entry.
>
> > > > > Can I get some help?
>
> > > > > Model:
>
> > > > > <?php
> > > > >   class Category extends AppModel
> > > > >   {
> > > > >       var $name = 'Category';
>
> > > > >       var $validate = array(
> > > > >                     'category' => 'alphaNumeric'
> > > > >             );
>
> > > > >   }
>
> > > > > ?>
>
> > > > > Controller:
>
> > > > > <?php
> > > > >   class CategoriesController extends AppController
> > > > >   {
> > > > >           var $name = 'Categories';
>
> > > > >         function index()
> > > > >     {
> > > > >                 $this->set('categories', 
> > > > > $this->Category->find('all'));
> > > > >           }
> > > > >     function add()
> > > > >     {
> > > > >                   if (!empty($this->data))
> > > > >       {
> > > > >                           if ($this->Category->save($this->data))
> > > > >         {
> > > > >                                   $this->Session->setFlash('Your
> > > category has been saved.');
> > > > >                                   $this->redirect(array('action' =>
> > > 'index'));
> > > > >                           }
> > > > >                   }
> > > > >           }
> > > > >     function edit($id = null)
> > > > >     {
> > > > >             $this->Category->id = $id;
> > > > >             if (empty($this->data))
> > > > >       {
> > > > >                 $this->data = $this->Category->read();
> > > > >         } else
> > > > >       {
> > > > >                 if ($this->Category->save($this->data))
> > > > >         {
> > > > >                         $this->Session->setFlash('Your category has
> > > been updated.');
> > > > >                         $this->redirect(array('action' => 'index'));
> > > > >                 }
> > > > >         }
> > > > >     }
> > > > >     function delete($id)
> > > > >     {
> > > > >         $this->Category->del($id);
> > > > >         $this->Session->setFlash('The category with id: '.$id.' has
> > > been
> > > > > deleted.');
> > > > >         $this->redirect(array('action'=>'index'));
> > > > >     }
>
> > > > >   }
> > > > > ?>
>
> > > > > View:
>
> > > > > <!-- File: /app/views/categories/add.ctp -->
>
> > > > > <h1>Add Post</h1>
> > > > > <?php
> > > > >         echo $form->create('');
> > > > >         echo $form->input('category');
> > > > >         echo $form->end('Save Category');
> > > > > ?>
>
> > > > > Thanks in advance.
>
> > --
> > Regards,
> > Mohammad Arif Hossen
> > Junior Web Developer
> > United Group International(UGIBD)
> > Mobile: +88 01714355911
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to