'rule' => VALID_NOT_EMPTY,
'required' => true
On Apr 7, 10:21 am, Duro <[EMAIL PROTECTED]> wrote:
> Furthermore...The solution I mentioned in my previous post does not
> quite work the way I'd hoped. It allows single words (ie. test123),
> but if you put spaces in the field (ie. test 123) it doesn't work,
> since it is no longer just letters and numbers. I tried removing the
> rule, but it throws a preg_match error.
>
> My questions is simple. How do I so a simple required field
> validation?
>
> Thanks for any help.
>
> Adam D.
>
> On Apr 7, 1:45 am, Duro <[EMAIL PROTECTED]> wrote:
>
> > So I've searched this group and other places on the web, and I still
> > can't seem to figure out why Validation rules don't work. It seems
> > others have had this problem, but only one solution works, and it is
> > totally contrary to what every other Manual, API, or Blog post has
> > said SHOULD work.
>
> > I am trying to get a field to simply be required. That's it. This is
> > the only piece of code I can get to work, and it seems like overkill
> > for this simple rule:
>
> > var $validate = array(
> > 'port_client' => array(
> > 'client_required' => array(
> > 'rule' => array('alphaNumeric'),
> > 'required' => true,
> > 'allowEmpty' => false,
> > 'message' => 'You must enter a client for this
> > item.'
> > )
> > )
> > )
>
> > I've tried the following (the first of which comes right out of the
> > cookbook), all to no avail:
>
> > var $validate = array(
> > 'port_client' => array(
> > 'rule' => 'alphaNumeric',
> > 'required' => true
> > )
> > );
>
> > -----------------
>
> > var $validate = array(
> > 'port_client' => array(
> > 'required' => true
> > )
> > );
>
> > -------------------
>
> > When I use the latter two pieces of code and try inputting a value
> > into the field, it doesn't validate, it gives me the 'Required' or
> > 'This field can't be blank' message, even though there is clearly
> > something in the field.
>
> > Environment Stats:
> > - PHP 5.2
> > - CakePHP 1.2
> > - Database: MySQL 5.0
>
> > Any help is appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---