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 7082363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:02:37+00:00 2026-05-28T07:02:37+00:00

I am using jQuery validation to attempt to keep a user from posting back

  • 0

I am using jQuery validation to attempt to keep a user from posting back unless he meets a couple of qualifications. But the required option doesn’t seem to be keeping the form from submitting…

Here is jsFiddle with an example: jsFiddle

I double checked my jQuery code and it would seem as though it was working. jsFiddle says it valid code. So I am not sure what the hangup is?

Thanks

  • 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-05-28T07:02:38+00:00Added an answer on May 28, 2026 at 7:02 am

    jQuery.validate uses names for the rules, not ids. So replace the ids with names in your input fields.

    Also your form should be <form id="temp1"> and not <form id="#temp">.

    Here’s a link to your fixed code:

    <form id="temp1">
        <input type="text" name="HospitalFinNumber"/> Hospital Fin<br/>
        <input type="text" name="DateOfBirth"/>Date of Birth<br/>
        <input type="text" name="AdmitDate"/>Admit Date<br/>
        <input type="text" name="Comment"/>Comment<br/>
        <input type="submit" value="Save" class="button" id="btClick"/>
    </form>
    

    and the script:

    $(document).ready(function () {
        $("#temp1").validate({
            rules: {
                HospitalFinNumber: {
                    required: true,
                    minlength: 6
                },
                DateOfBirth: {
                    required: true
                },
                AdmitDate: {
                    required: true
                },
                Comment: {
                    required: function (element) {
                        return $(element).val().length < 4000;
                    },
                    maxlength: 4000
                }
            },
            messages: {
                HospitalFinNumber: 'Please Enter a Hospital Fin number',
                DateOfBirth: 'Please enter a valid Date Of Birth',
                AdmitDate: 'Please select an Admit Date',
                Comment: 'Why dont you stop attempting to put in more than 4000 characters?  Thanks...'
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the jquery validation plugin from: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ How can I add a
I'm using jquery validation, however a few particular field values can be copied from
I am validating form using jquery validation plugin...... rules: { Name: required, MobileNo: {
I am using jquery validation for required field vaidation. $(#registerform).validate(); This fires for the
Using jQuery validation plugin but it has no CSV validation. I have made an
I have a form with a couple of buttons and I'm using jQuery Validation
I am using jQuery validation plugin to validate my form, but it is seems
I am using jquery validation plugin 1.9.0 . I have downloaded the plugin from
I'm using jQuery validation engine for the user registration form on my site and
I am using JQuery Validation . Now I want my rules to be invoked

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.