Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Remove those custom <code>htmlAttribute</code> from the view. Razor will creat it automaticly for you.</p> <p><b>View</b></p> <pre><code>@for (int i = 0; i &lt; 7; i++) { &lt;div class="form-field"&gt; @Html.HiddenFor(x =&gt; Model.StoreWorkingHours.FirstOrDefault(y =&gt; (int)y.DayInWeek == i + 1 &amp;&amp; y.IntervalInDay == IntervalInDay.IntervalOne).Id) @Html.HiddenFor(x =&gt; Model.StoreWorkingHours.FirstOrDefault(y =&gt; (int)y.DayInWeek == i + 1 &amp;&amp; y.IntervalInDay == IntervalInDay.IntervalOne).DayInWeek) @Html.HiddenFor(x =&gt; Model.StoreWorkingHours.FirstOrDefault(y =&gt; (int)y.DayInWeek == i + 1 &amp;&amp; y.IntervalInDay == IntervalInDay.IntervalOne).IntervalInDay) @Html.TextBoxFor(x =&gt; Model.StoreWorkingHours.FirstOrDefault(y =&gt; (int)y.DayInWeek == i + 1 &amp;&amp; y.IntervalInDay == IntervalInDay.IntervalOne).From) &lt;span class="field-validation"&gt;@Html.ValidationMessageFor(x =&gt; Model.StoreWorkingHours.FirstOrDefault(y =&gt; (int)y.DayInWeek == i + 1 &amp;&amp; y.IntervalInDay == IntervalInDay.IntervalOne).From)&lt;/span&gt; @Html.TextBoxFor(x =&gt; Model.StoreWorkingHours.FirstOrDefault(y =&gt; (int)y.DayInWeek == i + 1 &amp;&amp; y.IntervalInDay == IntervalInDay.IntervalOne).Until) &lt;span class="field-validation"&gt;@Html.ValidationMessageFor(x =&gt; Model.StoreWorkingHours.FirstOrDefault(y =&gt; (int)y.DayInWeek == i + 1 &amp;&amp; y.IntervalInDay == IntervalInDay.IntervalOne).Until)&lt;/span&gt; &lt;/div&gt; } </code></pre> <p>and on the <b>Custom validation script</b>, change it to this:</p> <pre><code>$.validator.addMethod("timelessthan", function (value, element, params) { console.log("HI :)"); return false; }); $.validator.unobtrusive.adapters.add("timelessthan", ["otherpropertyname"], function (options) { options.rules["timelessthan"] = "#" + options.params.otherpropertyname; options.messages["timelessthan"] = options.message; }); </code></pre> <p>Doing that you will see if its actually being called. If it's ok, i think that <code>"#" + options.params.otherpropertyname</code> will not give you the expected result. So you will have to change that too.</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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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