On Wednesday, 18 December 2013 16:22:45 UTC+10, advantage+ wrote:
I cannot validate my year select.
When posted it appears as :
data[Comunity][start][year]...
2009
Validation rule:
'start' => array(
'required' => true,
'allowEmpty' => false,
'rule' => array('checkYearValues', 'start'),
'message' => 'Please enter a year between 1950 and 2013 when you started.',
'last' => true),
checkYearVales:
/*****************************
****************************** * * FORM VALIDATION SELECT YEAR VALUES
* ******************************
***************************** * @access public
* @return bool
*
*
*
******************************
****************************** / public function checkYearValues($data, $field){
$value = $this->data[$this->alias][$
field ];
$baseYear = date('Y') - 2013 + 10;
$years = array_combine(range( date('Y'), date('Y') - $baseYear), range( date('Y'), date('Y') - $baseYear));
//return in_array($value, $years);
return false
}
But it always passes validation
Any ideas why start[year] gets added to the input?
Thanks all
Dave Maharaj
Freelance Designer | Developer
www.movepixels.com | dave@movepixels.com | 709.800.0852
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment