Monday, November 23, 2009

Validation Error

I have a select drop down for user to select a year.

In before save I have:

$this->data['Award']['year'] = $this->data['Award']['year']['year'];
since when I insepect the request the data looks like

[year] => Array
(
[year] => 2009
)
validation rule looks like:

'year' => array(
'year-notempty' => array(
'rule' => array('notempty'),
'required' => true,
'allowEmpty' => false,
'message' => '* Please enter the year you recieved this Award.',
'last' => true)
)


But i get this error:

<b>Warning</b> (2)</a>: preg_match() expects parameter 2 to be string,
array given [<b>CORE/cake/libs/validation.php</b>, line <b>848</b>]


Any ideas where I am going wrong?

--

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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en.

No comments: