Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery.validate.unobtrusive.js is killing my selectList()
    primarykey
    data
    text
    <p>Or maybe its the other way around?</p> <p>I am new MVC so be gentle. I can select a value from a <code>Html.DropDownList</code> and it populates to the model when saved. However if I click out of the box <code>jQuery.Validate</code> barks at me with an error about null data. </p> <p>This is the error</p> <pre><code>+ this function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context, rootjQuery ); } Object, (Function) </code></pre> <p>This is the view</p> <pre><code>@model Game.Domain.Equipment &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.BaseGameObject.Name) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.EditorFor(model =&gt; model.BaseGameObject.Name) @Html.ValidationMessageFor(model =&gt; model.BaseGameObject.Name) &lt;/div&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.BaseGameObject.Description) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.EditorFor(model =&gt; model.BaseGameObject.Description) @Html.ValidationMessageFor(model =&gt; model.BaseGameObject.Description) &lt;/div&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.Type) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.DropDownListFor(model =&gt; model.Type, new SelectList(Enum.GetValues(typeof(Game.Domain.EquipmentType)))) &lt;/div&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.Value) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.EditorFor(model =&gt; model.Value) @Html.ValidationMessageFor(model =&gt; model.Value) &lt;/div&gt; </code></pre> <p>This is the model</p> <pre><code>namespace Game.Domain { public class Equipment { public Equipment() { BaseGameObject = new BaseGameObject(); } public virtual int Id { get; set; } public virtual BaseGameObject BaseGameObject { get; set; } public virtual EquipmentType Type { get; set; } public virtual int Value { get; set; } } } </code></pre> <p>I have attempted to turn off the jvalidate jquery with jquery</p> <pre><code>$(function () { var select = $('select'); $('select').attr("willValidate", false) }); </code></pre> <p>But no matter what I try I get same jvalidate error over and over. Its damned annoying =)</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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