Re: form validation using model

2009-06-19 Thread Marcelo Andrade

On Thu, Jun 18, 2009 at 12:21 AM, puneetratan wrote:
> (..)
>
> and one more thing, that when i use $form->input then validations
> appears but when i use $form->text then validations does not appear,

I see you solved it.  But just for reference, $form->text
doesn't provide validation messages.  So you have to
put $form->error() near it.

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.com

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: form validation using model

2009-06-19 Thread puneet sharma
Hello everyone,

this problem has been solved,



On Thu, Jun 18, 2009 at 8:51 AM, puneetratan  wrote:

> Hello everyone,
> i am placing validations using model with the following syntx, can
> anyone tell me where i am wrong, bcoz validations are not coming.
>
> var $validate = array(
>'first_name' => array(
>'rule' => 'alphaNumericDashUnderscore',
>'message' => 'First Name must be character value'
>)
>
>);
>
>
> function alphaNumericDashUnderscore($data) {
>// $data array is passed using the form field name as the
> key
>// have to extract the value to make the function generic
>$value = array_values($data);
>$value = $value[0];
>return preg_match('|^[a-zA-Z-]*$|', $value);
>}
>
>
> and one more thing, that when i use $form->input then validations
> appears but when i use $form->text then validations does not appear,
>
> syntx is following
>
> echo $form->input('User.first_name', array('div' => array('id' =>
> 'mainDiv', 'title' => 'Div Title', 'style' =>
> 'display:block;float:left'),'size'=>'25'));
>
> echo $form->text('User.first_name');
>
>
> plz response me asap..
>
> Thanks
> Puneet

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



form validation using model

2009-06-17 Thread puneetratan

Hello everyone,
i am placing validations using model with the following syntx, can
anyone tell me where i am wrong, bcoz validations are not coming.

var $validate = array(
'first_name' => array(
'rule' => 'alphaNumericDashUnderscore',
'message' => 'First Name must be character value'
)

);


function alphaNumericDashUnderscore($data) {
// $data array is passed using the form field name as the key
// have to extract the value to make the function generic
$value = array_values($data);
$value = $value[0];
return preg_match('|^[a-zA-Z-]*$|', $value);
}


and one more thing, that when i use $form->input then validations
appears but when i use $form->text then validations does not appear,

syntx is following

echo $form->input('User.first_name', array('div' => array('id' =>
'mainDiv', 'title' => 'Div Title', 'style' =>
'display:block;float:left'),'size'=>'25'));

echo $form->text('User.first_name');


plz response me asap..

Thanks
Puneet
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---