Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9195601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:39:49+00:00 2026-06-17T21:39:49+00:00

I have set up model validation for my form but validation doesn’t seem to

  • 0

I have set up model validation for my form but validation doesn’t seem to work at all. I don’t suppose anybody can help. I’ve tried using the below work-around but that keeps pulling up an ‘undefined’ error in firebug.

Example Work-Around Script:

<script type="text/javascript">
    $(document).ready(function () {            
        $.validator.setDefaults({ ignore: [] });
    });
</script>

Example Text Field (Note: autocomplete text field with name of customer):

    @Html.TextBox("txtCustomer", null, new { @id = "txtCustomer", @class = "txt" })

Example Hidden Field (Note: When selection is made from the autocomplete field, the id is injected into the hidden field):

    @Html.HiddenFor(model => model.Customer_ID, new { @id = "hCustomerID" })

Example Model Data Annotation

    [Range(1, Int32.MaxValue, ErrorMessage = "Please select a customer")]
    public int Customer_ID { get; set; }

EDIT: Screenshot of errors

Sorry i have to post links to the screenshots because my rep points are high enough.

UI Postback Error

EDIT: Screenshot showing page source

Screenshot of Page Source

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:39:50+00:00Added an answer on June 17, 2026 at 9:39 pm

    Its too late to change the ignore on the validator in this way after the unobtrusive script. This is because the validator only pulls in the defaults once – when it is created. The unobtrusive script creates the validator for you. You need to reference the existing validator object and update it.

    try this

    <script>
        $(document).ready(function () {            
            $('form').validate().settings.ignore = []
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a login form in CodeIgniter -- I can set validation rules
I have set validation attributes in the model of my WCF service [MinLength(6, ErrorMessage
Suppose I have my models set up already. class books(models.Model): title = models.CharField... ISBN
This is my custom model binder. I have my breakpoint set at BindModel but
Rails form validation is designed to go in the model most easily. But I
The default validation for the form I have works as expected. But when a
I have a weird problem with R that I can't seem to work out.
I have a model set out like so: class Rating # user_id, author_id end
I have set up a Core Data model where I have two objects, say
I have set up a Core Data model that includes an entity, Item with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.