Wednesday, August 27, 2014

Select Null option on helper on CakePHP3

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.

No comments: