Friday, May 6, 2011

How to do validation

Hi guys,

I am new to cakephp i want to know how to do the validation in the
cakephp,

if i use the

$options = array(
'Mr' => 'Mr',
'Mrs' => 'Mrs',
'Ms' => 'Ms',
'Miss' => 'Miss'
);
echo $this->Form->input('title', array('type' => 'select', 'options'
=> $options, 'empty' => 'Please select'));

then the server side validation is working fine, but if i use this
code,

$options = array(
'Mr' => 'Mr',
'Mrs' => 'Mrs',
'Ms' => 'Ms',
'Miss' => 'Miss'
);
echo $this->Form->select('title', $options,null,array('empty' =>
'Please select'));

my server side validation is not working.
Same thing is happing if i use the following code for the textbox
e.g. echo $this->Form->input('forename', array('class' => 'text'));

but works fine for the following
echo $this->Form->input('forename', array('class' => 'text'));

Can anybody can tell why its not working.
tanks in advance.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: