Re: passing showEmpty from $form->input to a select

2008-04-11 Thread RichardAtHome

Blinding! TYVM :-)

On Apr 11, 4:20 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> http://book.cakephp.org/view/201/options-empty
>
> On Fri, Apr 11, 2008 at 11:52 AM, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> >  Hi All :-)
>
> >  Cake 1.2.0.6311 beta
>
> >  I am using the following code to create a drop down select box for a
> >  field in a view:
>
> >  echo $form->input('institution_id',array("label"=>"Institution *",
> >  "class"=>"input", "div"=>"input mandatory", "selected"=>$preSelect-
> >  >select("institution_id")));
>
> >  ($preSelect is a custom helper that pre-selects an item from the list
> >  if it is present in the URL)
>
> >  As it stands, this code creates a drop down list as expected, but
> >  doesn't include an empty option.
>
> >  How do I get it to show an empty option at the top of the list (or
> >  better yet a 'Please Select...' option)?
>
> >  I've dug through the form helper code and I though this would work:
>
> >  echo $form->input('institution_id',array("label"=>"Institution *",
> >  "class"=>"input", "div"=>"input mandatory", "selected"=>$preSelect-
> >  >select("institution_id")),null,null,"Please Select");
>
> >  and
>
> >  echo $form->input('institution_id',array("label"=>"Institution *",
> >  "class"=>"input", "div"=>"input mandatory", "selected"=>$preSelect-
> >  >select("institution_id"), "showEmpty"=>"Please Select..."));
>
> >  but try as I might, I can't get $form->input() to pass the "Please
> >  Select" message through to $form->select()
>
> >  Oddly enough, the $input->select() code should default to providing an
> >  empty select code ($showEmpty = '') if non is specified, so $form-
> >  >input() must be passing in false to stop this from happening.
>
> >  Any ideas what I'm doing wrong?
>
> >  Thanks in advance :-)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: passing showEmpty from $form->input to a select

2008-04-11 Thread Dardo Sordi Bogado

http://book.cakephp.org/view/201/options-empty

On Fri, Apr 11, 2008 at 11:52 AM, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
>  Hi All :-)
>
>  Cake 1.2.0.6311 beta
>
>  I am using the following code to create a drop down select box for a
>  field in a view:
>
>  echo $form->input('institution_id',array("label"=>"Institution *",
>  "class"=>"input", "div"=>"input mandatory", "selected"=>$preSelect-
>  >select("institution_id")));
>
>  ($preSelect is a custom helper that pre-selects an item from the list
>  if it is present in the URL)
>
>  As it stands, this code creates a drop down list as expected, but
>  doesn't include an empty option.
>
>  How do I get it to show an empty option at the top of the list (or
>  better yet a 'Please Select...' option)?
>
>  I've dug through the form helper code and I though this would work:
>
>  echo $form->input('institution_id',array("label"=>"Institution *",
>  "class"=>"input", "div"=>"input mandatory", "selected"=>$preSelect-
>  >select("institution_id")),null,null,"Please Select");
>
>  and
>
>  echo $form->input('institution_id',array("label"=>"Institution *",
>  "class"=>"input", "div"=>"input mandatory", "selected"=>$preSelect-
>  >select("institution_id"), "showEmpty"=>"Please Select..."));
>
>  but try as I might, I can't get $form->input() to pass the "Please
>  Select" message through to $form->select()
>
>  Oddly enough, the $input->select() code should default to providing an
>  empty select code ($showEmpty = '') if non is specified, so $form-
>  >input() must be passing in false to stop this from happening.
>
>  Any ideas what I'm doing wrong?
>
>  Thanks in advance :-)
>  >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



passing showEmpty from $form->input to a select

2008-04-11 Thread RichardAtHome

Hi All :-)

Cake 1.2.0.6311 beta

I am using the following code to create a drop down select box for a
field in a view:

echo $form->input('institution_id',array("label"=>"Institution *",
"class"=>"input", "div"=>"input mandatory", "selected"=>$preSelect-
>select("institution_id")));

($preSelect is a custom helper that pre-selects an item from the list
if it is present in the URL)

As it stands, this code creates a drop down list as expected, but
doesn't include an empty option.

How do I get it to show an empty option at the top of the list (or
better yet a 'Please Select...' option)?

I've dug through the form helper code and I though this would work:

echo $form->input('institution_id',array("label"=>"Institution *",
"class"=>"input", "div"=>"input mandatory", "selected"=>$preSelect-
>select("institution_id")),null,null,"Please Select");

and

echo $form->input('institution_id',array("label"=>"Institution *",
"class"=>"input", "div"=>"input mandatory", "selected"=>$preSelect-
>select("institution_id"), "showEmpty"=>"Please Select..."));

but try as I might, I can't get $form->input() to pass the "Please
Select" message through to $form->select()

Oddly enough, the $input->select() code should default to providing an
empty select code ($showEmpty = '') if non is specified, so $form-
>input() must be passing in false to stop this from happening.

Any ideas what I'm doing wrong?

Thanks in advance :-)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---