Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC client validation causing false errors
    primarykey
    data
    text
    <p>I'm hoping someone has run into something similar. A text input <strong>with</strong> text is triggering the client-side [Required] error message.</p> <p>I have the following included in the master:</p> <pre><code>&lt;script src="/Scripts/jquery-1.4.1.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/Scripts/MicrosoftAjax.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/Scripts/MicrosoftMvcAjax.debug.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/Scripts/MicrosoftMvcValidation.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/Scripts/jquery.validate.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>as well as having</p> <pre><code>&lt;% Html.EnableClientValidation(); %&gt; </code></pre> <p>in the view.</p> <p>A couple possible factors:</p> <ul> <li>The form is in a partial view </li> <li>The submitted text is coming from CKEditor </li> <li>The CKEditor is hidden on page load and then revealed via jQuery</li> </ul> <p>I'm just not sure what could be causing this.</p> <p>Form:</p> <pre><code>&lt;form action="/Quote/Create/1" id="form0" method="post"&gt;&lt;div class="validation-summary-valid" id="validationSummary"&gt;&lt;ul&gt;&lt;li style="display:none"&gt;&lt;/li&gt; &lt;/ul&gt;&lt;/div&gt; &lt;fieldset&gt; &lt;legend&gt;Fields&lt;/legend&gt; &lt;div class="editor-field"&gt; &lt;input id="QuoteID" name="QuoteID" type="hidden" value="0" /&gt; &lt;/div&gt; &lt;div class="editor-field"&gt; &lt;input id="UserID" name="UserID" type="hidden" value="54cb0fde-649d-429c-8800-6bd9cc286d90" /&gt; &lt;/div&gt; &lt;div class="editor-label"&gt; &lt;label for="PageNumber"&gt;PageNumber&lt;/label&gt; &lt;/div&gt; &lt;div class="editor-field"&gt; &lt;input id="PageNumber" name="PageNumber" type="text" value="" /&gt; &lt;span class="field-validation-valid" id="PageNumber_validationMessage"&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class="editor-label"&gt; &lt;label for="QuoteText"&gt;QuoteText&lt;/label&gt; &lt;/div&gt; &lt;div class="editor-field"&gt; &lt;textarea cols="20" id="QuoteText" name="QuoteText" rows="2"&gt; &lt;/textarea&gt; &lt;span class="field-validation-valid" id="QuoteText_validationMessage"&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class="editor-field"&gt; &lt;input id="BookID" name="BookID" type="hidden" value="1" /&gt; &lt;/div&gt; &lt;div class="editor-field"&gt; &lt;input id="DateCreated" name="DateCreated" type="hidden" value="7/28/2010 9:21:36 PM" /&gt; &lt;/div&gt; &lt;p&gt; &lt;input id="quoteSubmit" type="submit" value="Create" /&gt; &lt;/p&gt; &lt;/fieldset&gt; &lt;/form&gt;&lt;script type="text/javascript"&gt; //&lt;![CDATA[ if (!window.mvcClientValidationMetadata) { window.mvcClientValidationMetadata = []; } window.mvcClientValidationMetadata.push({"Fields":[{"FieldName":"PageNumber","ReplaceValidationMessageContents":true,"ValidationMessageId":"PageNumber_validationMessage","ValidationRules":[{"ErrorMessage":"The field PageNumber must be a number.","ValidationParameters":{},"ValidationType":"number"}]},{"FieldName":"QuoteText","ReplaceValidationMessageContents":true,"ValidationMessageId":"QuoteText_validationMessage","ValidationRules":[{"ErrorMessage":"That quote is too long.","ValidationParameters":{"minimumLength":0,"maximumLength":500},"ValidationType":"stringLength"},{"ErrorMessage":"You didn\u0027t even enter a quote...","ValidationParameters":{},"ValidationType":"required"}]}],"FormId":"form0","ReplaceValidationSummary":false,"ValidationSummaryId":"validationSummary"}); //]]&gt; &lt;/script&gt; </code></pre> <p>When I take out the </p> <pre><code>&lt;% Html.EnableClientValidation(); %&gt; </code></pre> <p>server-side validation works fine and generates no error.</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.
 

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