DmitryEfimenko / TwitterBootstrapMvc

Fluent implementation of ASP.NET-MVC HTML helpers for Twitter Bootstrap.
Apache License 2.0
223 stars 79 forks source link

Input groups in a formgroup. #440

Open johnwc opened 7 years ago

johnwc commented 7 years ago

I need to be able to add a input group, so that I can show a currency symbol before the input field. I have no way of doing that.

This is the call today.

@f.FormGroup().EditorFor(m => m.StartPrice).Label().HelpIcon()

I need something like so...

@f.FormGroup().EditorFor(m => m.StartPrice).AppendInputGroup("$").Label().HelpIcon()

and produce...

<div class="input-group">
  <span class="input-group-addon">$</span>
  <input type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
</div>
DmitryEfimenko commented 7 years ago

Why can't you use @TextBoxFor:

@Html.Bootstrap().TextBoxFor(m => m.UserName).Prepend("$").Label().HelpIcon()
johnwc commented 7 years ago

I am using a FormGroup first. I need the EditorFor because it utilizes the metadata that is applied to the property, a TextBoxFor does not.