Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you need to add both jquery and jQuery Validation plugin (and optionally, the unobtrusive library)</p> <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="http://ajax.microsoft.com/ajax/jQuery.Validate/1.7/jQuery.Validate.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.min.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>so, your view will be as:</p> <pre><code>@using ErasProject.Models @model ErasProject.Models.Bulletin1ViewModel &lt;script src="jquery.min.js"&gt;&lt;/script&gt; &lt;script src="jQuery.Validate.min.js"&gt;&lt;/script&gt; &lt;script src="jquery.validate.unobtrusive.min.js"&gt;&lt;/script&gt; @using (Html.BeginForm()) { @Html.ValidationSummary(true) &lt;fieldset&gt; &lt;p&gt; @Html.EditorFor(model =&gt; model.NumberDelegations) @Html.ValidationMessageFor(model =&gt; model.NumberDelegations) &lt;/p&gt; &lt;p&gt; @Html.EditorFor(model =&gt; model.TravelPlans) @Html.ValidationMessageFor(model =&gt; model.TravelPlans) &lt;/p&gt; &lt;p&gt; &lt;input type="submit" value="Submit" /&gt; &lt;/p&gt; &lt;/fieldset&gt; } </code></pre> <hr> <p>Just added your object and created a <code>Add</code> Action like:</p> <pre><code>public ActionResult Add() { return View(); } </code></pre> <p>and created a View using the <code>Create</code> template and the <code>Bulletin1ViewModel</code> class that look like this:</p> <pre><code>@model WebApp_MVC3.Models.Bulletin1ViewModel @{ ViewBag.Title = "Add"; Layout = "~/Views/Shared/_Layout.cshtml"; } &lt;h2&gt;Add&lt;/h2&gt; &lt;script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"&gt;&lt;/script&gt; @using (Html.BeginForm()) { @Html.ValidationSummary(true) &lt;fieldset&gt; &lt;legend&gt;Bulletin1ViewModel&lt;/legend&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.NumberDelegations) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.EditorFor(model =&gt; model.NumberDelegations) @Html.ValidationMessageFor(model =&gt; model.NumberDelegations) &lt;/div&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.TravelPlans) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.EditorFor(model =&gt; model.TravelPlans) @Html.ValidationMessageFor(model =&gt; model.TravelPlans) &lt;/div&gt; &lt;p&gt; &lt;input type="submit" value="Create" /&gt; &lt;/p&gt; &lt;/fieldset&gt; } &lt;div&gt; @Html.ActionLink("Back to List", "Index") &lt;/div&gt; </code></pre> <p>without doing anything more, the result is:</p> <p><a href="https://i.stack.imgur.com/C3Bs4.png" rel="nofollow noreferrer">original file</a></p> <p><img src="https://i.stack.imgur.com/C3Bs4.png" alt="enter image description here"></p> <p>I would re-check the javascript libraries...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload