<anandghaywankar567@gmail.com> wrote:
> hi, bakers
> i m working on one drop down list, i m getting all the values but the
> first option is coming blank. i want set this as "select state" with
> some value, like we used to in core php.
> my view code is as fallows
>
> <?php
> echo $form-
>>select('state_code',array($newStates),null,array('id'=>'select_states'),false);
> ?><br /><br /><?php
> // echo $form-
>>select('id',array(),null,array('id'=>'select_cities'),false);
>
> ?>
> <div id='select_cities'></div>
> </fieldset>
> </div>
>
> with this code when i see source view i get first option blank like
> bellow
>
> option value=""></option>
>
> <option value="Libya_general_list">Libya (general)</option>
> <option value="Baladiyat_al_`Aziziyah_list">Baladiyat al `Aziziyah</
> option>
> <option value="Baladiyat_al_Jufrah_list">Baladiyat al Jufrah</option>
> can any one suggest me, how to make first option as "select
> something" in cake
The API documentation is still VERY confusing on this. The answer is
to include 'empty' => false in the array that is the 4th param.
echo select('name', $options, null, array('id'=>'select_states',
'empty' => false));
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment