Tuesday, 6 September 2011

cakephp1.3 selectbox/dropdown not showing error message

Suppose we have following array, which we want to show in dropdown.
 $verify_status = array('1'=>__('YES',true), '0'=>__('NO',true) ); 

Following code will NOT work.
echo $form->select('User.verify_email', $verify_status, null, array('class'=>'text-fields','label'=>false, 'div'=>false,'empty'=>__('SELECT', true))); 

Following code will WORK.
echo $form->input('User.verify_email', array('type'=>'select', 'options'=>$verify_status,'class'=>'text-fields','label'=>false, 'div'=>false,'empty'=>__('SELECT', true))); 

Remember: CakePHP might have cached the page. Make sure your debug value is set to 1 or 2 in app/config/core.php to disable caching.Please set to 0 in production server.