-
Notifications
You must be signed in to change notification settings - Fork 11.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow toggle of empty field in FormBuilder::select #743
Comments
Can't you just prepend an element to the array you are passing. I don't want to bake more option arrays like this into the method. |
Yes, prepending does work, although I didn't know if it would be considered a data hack or not. |
That answer is ignorant. You will be code duplicating, an option for this would be appropriate. |
This is the top result on Google for "laravel form builder empty option", that's why I am posting here. It can be a pain to manually add an empty option for a Since the FormBuilder has moved to a separate repository however, let us move to laravelcollective/html. |
If a single select field is optional, convention is usually that you include a blank option along with the list of options.
When I'm assigning the list of values via a query from the database, I currently have no way of telling it to inject a blank option (which should appear first and checked by default if no value is set).
Ideally something like:
{{ Form::select(..., ..., ..., array('addEmpty' => true)) }}
...would do nicely!
The text was updated successfully, but these errors were encountered: