You could use the last parameter of select $showempty. if you set it to "Select Genre", this will appear first and in your validation you could use "VALID_NOTEMPTY"
On Jun 21, 2:12 am, mastorna <[EMAIL PROTECTED]> wrote: > I have a select box using 1.2's formHelper and I cannot get it to pass > validation. The view looks like this: > > echo $form->select('Mixtape.genre', > array( > "0" =>"Select Genre", > "Classical"=>"Classical", > "Country / Folk"=>"Country / Folk", > "Latin"=>"Latin", > "Rock / Pop"=>"Rock / Pop", > "Soundtracks"=>"Soundtracks", > "Spoken / Comedy"=>"Spoken / Comedy", > "World Music"=>"World Music"),null,array('div' => true, 'label' => > false, 'class'=>'required', 'error' => 'Please specify a valid > genre'),false); > > My model has the validation, which isn't seemingly detecting any > errors. > > var $validate = array('genre' => array('rule' => array('comparison', '! > =', 0))); > > I'm basically trying to force them not to select the first item in the > select field ("Select Genre"). If they do select it, I want it to > print out the error, but its not catching it. Any reason why? Am I > going about my validation in 1.2 incorrectly for form->select(). I'm > using the same technique for $form->input and it works great. > > -lm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---