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
Description: header_logo
www.movepixels.com  |   <mailto:[email protected]> [email protected]  |
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

<<image001.jpg>>

Reply via email to