Quantcast

validation notEmpty

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

validation notEmpty

kaushik-2-3

I am using following code for validating a not empty field.
var $validate = array(
       'blogCategoryId' => array(
                'required' => array('rule' => 'notEmpty',
'message'=>'Please select Blog category.'),
        )
        );

It is working properly but giving the following warning:

Warning (2): preg_match() [function.preg-match]: Delimiter must not be
alphanumeric or backslash [CORE/cake/libs/model/model.php, line 2193]

Can anyone highlight what is problem in code?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: validation notEmpty

Yasir Arafat Hasib
'names' => array('rule'=>VALID_NOT_EMPTY ,'message'=>'Please provide your name.'),

You can use it for your validation.

On Wed, Mar 4, 2009 at 4:23 PM, kaushik <[hidden email]> wrote:

I am using following code for validating a not empty field.
var $validate = array(
      'blogCategoryId' => array(
               'required' => array('rule' => 'notEmpty',
'message'=>'Please select Blog category.'),
       )
       );

It is working properly but giving the following warning:

Warning (2): preg_match() [function.preg-match]: Delimiter must not be
alphanumeric or backslash [CORE/cake/libs/model/model.php, line 2193]

Can anyone highlight what is problem in code?





--
Regards
------------------------------------
Yasir Arafat
Web developer
United Group International
01816536901

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: validation notEmpty

brian-9
In reply to this post by kaushik-2-3

Which version are you using?

On Wed, Mar 4, 2009 at 5:23 AM, kaushik <[hidden email]> wrote:

>
> I am using following code for validating a not empty field.
> var $validate = array(
>       'blogCategoryId' => array(
>                'required' => array('rule' => 'notEmpty',
> 'message'=>'Please select Blog category.'),
>        )
>        );
>
> It is working properly but giving the following warning:
>
> Warning (2): preg_match() [function.preg-match]: Delimiter must not be
> alphanumeric or backslash [CORE/cake/libs/model/model.php, line 2193]
>
> Can anyone highlight what is problem in code?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: validation notEmpty

sologroupmc
In reply to this post by kaushik-2-3

'Required' is not a rule as noted in http://book.cakephp.org/view/127/One-Rule-Per-Field

Your code should be:

var $validate = array(
     'blogCategoryId' => array(
          'rule' => 'notEmpty',
          'required' => true,
          'message'=>'Please select Blog category.'
     )
);


On Mar 4, 5:23 am, kaushik <[hidden email]> wrote:

> I am using following code for validating anotempty field.
> var $validate = array(
>        'blogCategoryId' => array(
>                 'required' => array('rule' => 'notEmpty',
> 'message'=>'Please select Blog category.'),
>         )
>         );
>
> It is working properly but giving the following warning:
>
> Warning (2): preg_match() [function.preg-match]:Delimitermustnotbealphanumericorbackslash[CORE/cake/libs/model/model.php, line 2193]
>
> Can anyone highlight what is problem in code?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: validation notEmpty

Stu-2

sologroup's method still gave me the same error.  Might depend on the
version.  For those using 1.2.0.7119 RC1, use Yasir's answer:

'names' => array(
   'rule'=>VALID_NOT_EMPTY ,
   'message'=>'Please provide your name.' )
)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Loading...