Skip to content

Conversation

pedroborges
Copy link
Contributor

This is one of the small things I'd like to see in Laravel, support for the label element in the Form class.

I added it and would like to hear your thoughts on it. It can be used as other Form methods.

Form::label('email', 'Email:')

The problem is that to work properly, allowing people to select the input field by clicking on the label, the input needs an id. Which is not added by default, but can be passed as an array. What about detect if there is an label for that input and automatically add the id?

@pedroborges
Copy link
Contributor Author

My English is not the best, so I added only a basic comment to $labels and label(). Feel free to complete them if needed!

@taylorotwell
Copy link
Member

This looks good! I'll merge it in when I get home tonight. Thanks for your contribution! Only thing I see is you misspelled "label" on your property description.

@pedroborges
Copy link
Contributor Author

Great. I'm glad to help.

Note the 2nd param for label() is mandatory since there's no reason to have a label without name.

taylorotwell added a commit that referenced this pull request Jun 14, 2011
Added <label> element to form class. Input elements will automatically receive the ID of the corresponding label element if one exists.
@taylorotwell taylorotwell merged commit 80173d4 into laravel:develop Jun 14, 2011
zoe-edwards pushed a commit to zoe-edwards/laravel that referenced this pull request Oct 14, 2013
Update src/Illuminate/Events/Dispatcher.php
GrCOTE7 added a commit to c57fr/laravel that referenced this pull request May 21, 2017
flap152 pushed a commit to flap152/laravel that referenced this pull request Nov 24, 2017
flap152 pushed a commit to flap152/laravel that referenced this pull request Nov 24, 2017
phithienthan referenced this pull request in phithienthan/laravel Apr 18, 2018
sl0wik added a commit to sl0wik/laravel that referenced this pull request Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants