As per the CakePHP 3 API you can still pass empty to $this->Form->select (similar to 2.x)
http://api.cakephp.org/3.0/class-Cake.View.Helper.FormHelper.html#_select
This isn't mentioned in the CakePHP 3 FormHelper book though it seems.
http://api.cakephp.org/3.0/class-Cake.View.Helper.FormHelper.html#_select
This isn't mentioned in the CakePHP 3 FormHelper book though it seems.
On 27 August 2014 13:54, Jipson Thomas <jipson@strategic-ic.co.uk> wrote:
Hi,--
Would you please let me know how I can add a Null option to Cake php3 form helper.
In my drop down I am listing all the company names from database, but I don't know how I can add a null option to this. Because of this, I am compelled to select any company and it is not letting me to choose no company.
The Code I use is as following.
Controller
======
$this->set('company_list',$company_list);
View
=========
echo $this->Form->select('company_id',['Company' => $company_list]);
Thanks,
Jipson
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
Kind Regards
Stephen Speakman
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment