<?echo $form->create('user', array('action' => 'signup'));?>
<fieldset>
<legend>Signup</legend>
<?php
echo $form->input('users_name',array("label"=>"Name:"));
echo $form->error('users_name');
echo $form->input('users_email',array("label"=>"Email:"));
echo $form->error('users_email');
echo $form->input('users_password',array
("label"=>"Password:","type"=>"password"));
echo $form->input('password_confirm',array('label'=>'Password
Confirm:','type'=>'password'));
echo $form->error('users_password');
echo $form->error('password_confirm');
?>
</fieldset>
<?echo $form->end("Sign Up");?>
This is how my view looks like. I am still not getting the errors. But
my validation is working as it only inserts into the database when the
data is correct.
var $validate = array(
"users_name" => array("rule" => "alphaNumeric","required" =>
true,"allowEmpty"=>false,"message" => "Alphabets and numbers only"),
"users_email" => array(
"email"=>array("rule"=>"email","message"=>"Invalid email
address","required" => true,"allowEmpty"=>false),
"unique"=>array("rule"=>array
("validateUniqueEmail"),"message"=>"This Email is already in
use","required" => true,"allowEmpty"=>false)),
"users_password" => array("rule" => array
("confirmPassword","password"),"required"=>true,"allowEmpty"=>false,"message"
=> "Password do not match"),
"password_confirm" => array("rule" => "alphaNumeric","required"
=>
true)
);
This is how my validate array in model looks like confirmPassword and
validateUniqueEmail are function that I wrote. I am not able to figure
out why this is happening.
On Jan 7, 3:12 pm, Nature Lover <[email protected]> wrote:
> Hi,
>
> @Lucas =>
> For compulsory fields in a form the validation in model will be like:
>
> var $validate = array(
> 'field_name' => array(
> 'notEmpty' => array(
> 'rule' => 'notEmpty',
> 'message' => 'Required'
> )
> )
> );
>
> Above will make it compulsory for the field to have data when
> submitted.
> ____________________________________________________________________________
>
> @josnidhin=>
> The validation error will be shown automatically along the fields if
> you are creating inputs using form helper.
> Otherwise the below code will work:
>
> <? if($form->isFieldError('ModelName.field_name')){e($form->error
> ('ModelName.field_name'));}?>
>
> Have a nice day!
>
> On Jan 7, 11:36 am,josnidhin<[email protected]> wrote:
>
> > Hi,
> > I am also experiencing the same problem. I dont know how to get the
> > messages to show in the view when the validation fails.
>
> > On Jan 4, 12:31 am, Lucas <[email protected]> wrote:
>
> > > Hi gearvOsh,
>
> > > Unfortunately nothing happens again :(
> > > I tryed with both options (required = true and notEmpty rule) and
> > > nothing happens.
>
> > > More tips?
>
> > > Thanks!
>
> > > On 29 dez 2008, 23:24, gearvOsh <[email protected]> wrote:
>
> > > > You either need to have:
>
> > > > required = true
>
> > > > Or use the notEmpty rule.
>
> > > >http://book.cakephp.org/view/127/One-Rule-Per-Fieldhttp://book.cakeph...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---