Friday, February 12, 2010

CakePHP Select Empty

Say, you have a select box displaying dropdown options for categories. You want to give the user liberty to select nothing. In CakePHP it is pretty simple. Use 'empty' options in your view file.


<?php echo $form->input('category_id', array( 'empty' => '(choose one)')); ?>

Hope this helps someone.
Happy baking.

No comments: