1

Does anyone know why my form elements are not showing up in the web page AFTER the div (id=map-canvas) to hold the Google Map - it's bizarre. So in the example below it's not showing the "Confidence" field and the Submit button - any ideas??

BTW - if I put the div outside of the form - everthing renders ok.

@using (Html.BeginForm("Create", "Foo", FormMethod.Post, new { autocomplete = "off" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>FooLegend</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Confidence)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Confidence)
            @Html.ValidationMessageFor(model => model.Confidence)
        </div>

        <div id="map-canvas"/>

         <div class="editor-label">
            @Html.LabelFor(model => model.Notes)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Notes)
            @Html.ValidationMessageFor(model => model.Notes)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>

    </fieldset>
}
Vidar
  • 6,548
  • 22
  • 66
  • 96

1 Answers1

1

Unless you are using XHTML, <div> is not a self closing tag. In HTML 4 and 5, you cannot self-close <div>. Try this instead:

<div id="map-canvas"></div>

Ref. Is it OK to use a self closing DIV tag?

Ref. Are (non-void) self-closing tags valid in HTML5?

Community
  • 1
  • 1
user1477388
  • 20,790
  • 32
  • 144
  • 264
  • Wow - such a dope, that just goes to show what can happen when you blindly copy code from help guides. Thanks for that - changing that div tag sorted the problem nicely! – Vidar Aug 02 '13 at 20:40