adamwathan / bootforms

Rapid form generation with Bootstrap 3 and Laravel.
MIT License
417 stars 103 forks source link

Option to add extra HTML after input #29

Closed msieprawski closed 10 years ago

msieprawski commented 10 years ago

Hi,

Is there any option to pass extra HTML after specific input? I've got some text fields which require additional help-block (bootstrap) with some info for user.

It would be great to do something like this: {{ BootForm::text('Price', 'price')->html('<span class="help-block">My text</span>') }} Or {{ BootForm::text('Price', 'price')->helpBlock('My text') }}

Current result is: <div class="form-group"><label for="price" class="col-lg-3 control-label">Price</label><div class="col-lg-9"><input type="text" class="form-control" id="price" name="price" /></div></div>

Expected result: <div class="form-group"><label for="price" class="col-lg-3 control-label">Price</label><div class="col-lg-9"><input type="text" class="form-control" id="price" name="price" /><span class="help-block">My text</span></div></div>

Best regards, Mateusz

adamwathan commented 10 years ago

You can actually do this already and this code example you supplied is the exact syntax! :)

{{ BootForm::text('Price', 'price')->helpBlock('My text') }}

One note is that the help block will be overridden by any error messages if there are any. If you need more customization than that, it's probably better to write the markup yourself and use my lower level Form package that BootForms uses under the hood: https://github.com/adamwathan/form

This reminds me that I need to update the documentation though, so thanks!