dwightwatson / bootstrap-form

Bootstrap 3 form builder for Laravel
MIT License
217 stars 133 forks source link

Marking field as required in label #72

Closed msieprawski closed 7 years ago

msieprawski commented 7 years ago

Hello,

Is there any way to mark a label as required? I wanted to add something like asterisk right after the label wrapped in span with my custom class but I get HTML being displayed as label.

dwightwatson commented 7 years ago

I believe you can pass the label in as the second parameter, so you could do whatever you like. Something like...

BootForm::text('email', 'Email*')

It won't support HTML however, it would get escaped. We could probably support Laravel's HtmlString as an input, but it would require you new up an instance of that and pass it in.

BootForm::text('email', new Illuminate\Support\HtmlString('<span>Email*</span>'))

What do you think?

msieprawski commented 7 years ago

Hi @dwightwatson, sorry for late response. Sure your idea seems to be the best way for now. Waiting for the new feature ;)