DmitryEfimenko / TwitterBootstrapMvc

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

Extra label rendered for FormGroup().CustomControls() #145

Closed JustinPierce closed 10 years ago

JustinPierce commented 10 years ago

I have the following markup:

@form.FormGroup().CustomControls(
    Html.Bootstrap().SubmitButton()
        .Id("saveButton")
        .Text("Continue")
        .AppendIcon(new Icon("fa fa-arrow-circle-right"))
        .Style(ButtonStyle.Success),
    Html.Bootstrap().Button()
        .Text("Cancel"))

BMVC is rendering an extra label inside of the form group HTML, before the first button:

<div class=" form-group">
  <label class="control-label" for="">
    <span class="required" style="visibility:hidden;">*</span>
  </label>
  <button class="btn-success  btn" id="saveButton" type="submit">
    Continue
    <i class="fa fa-arrow-circle-right"></i>
  </button>
  <button class="btn-default  btn" type="button">Cancel</button>
</div>

This behavior appears to have started with version 3.5.4.

DmitryEfimenko commented 10 years ago

what form type is it? Does not look like horizontal... Also, what effect does it have if label text is not shown and required star is hidden as well?

JustinPierce commented 10 years ago

It's a plain old form: @using (var form = Html.Bootstrap().Begin(new Form()))

The required star isn't 100% hidden. Because its style is visible: hidden (as opposed to display: none), it still takes up space in the layout. That's the only reason I noticed it.

DmitryEfimenko commented 10 years ago

the reason I used visible: hidden instead of display: none is so that right aligned labels still look aligned even if some fields are required and others are not. Though I see how this star is not needed there at all if label text is empty. I'll make necessary updates this evening.

DmitryEfimenko commented 10 years ago

should be fixed. Please check.

JustinPierce commented 10 years ago

This appears to be fixed. Thanks!