Thanks - that worked spot on. In fact I shortened it a bit to:

echo $form->input('listname', array('options'=>array('Please choose a
value') + $mylist));

So simple when you know the answer!

Thank you.

On Aug 12, 4:08 pm, Marcelo Andrade <[email protected]> wrote:
> > On Aug 11, 9:21 am, arif hossen <[email protected]> wrote:
> >> You can use below code cakephp format.
>
> >> <?php
>
> >> echo $html->input('listname',array('options'=>$mylist,'Selected'=>'Please
> >> select a value));
>
> Cake 1.1?
>
> On Wed, Aug 12, 2009 at 2:51 AM, jburns<[email protected]> wrote:
>
> > This doesn't add a new value to the list, just selects one that's
> > already there. I want the list to start of with a custom row that is
> > not in the database (such as "Please select a value") that will be
> > selected by default (unless there is already a selection) and the rest
> > of the list is drawn from the table.
>
> How about this?
>
> $default= 'Please select a value';
> $theOptions= array($default) + $mylist;
>
> $form->input('listname',array('options'=>$theOptions,'selected'=> $default);
>
> But there are other ways to to it.  If that's the case,
> you can add a default value with javascript too.
>
> Best regards.
>
> --
> MARCELO DE F. ANDRADE
> Belem, PA, Amazonia, Brazil
> Linux User #221105
>
> http://mfandrade.wordpress.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to