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

  • Home
  • SEARCH
  • 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 7507985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:35:43+00:00 2026-05-29T22:35:43+00:00

I am looking to validate a form element using ajax validation using the OnBlur

  • 0

I am looking to validate a form element using ajax validation using the OnBlur event (to cover key ups and cut and paste events). It looks like jquery Validation 1.9 does indeed have this feature. Can anyone confirm that it covers both key’ed entries in addition to copy/paste entries? Any examples of this using Asp.net MVC2? I do not have a strongly type view so my implementation may end being slightly more complicated that the usual example…

So far, I am going to try and call this function…

public string ValidateHosFin(string hospitalFin)
{
    if (!true)
        return "";
    return "true";

}

This is just a dummy for what the function really will be doing… That is just a test however… So far, I have my jquery Validation function set up like so…

$("#temp1").validate({
        rules: {
            HospitalFinNumber: {
                required: true,
                minlength: 6,
                remote: { url: '<%:Url.Action("ValidateHosFin", "PatientACO")%>', data: { hospitalFin: $('#HospitalFinNumber').val() }
                }
            }
}

The input element id for what I will be validating is HospitalFinNumber.
How can I ensure that this will work on both key input event’s as well as copy paste events?

  • 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-29T22:35:44+00:00Added an answer on May 29, 2026 at 10:35 pm

    Yes, this will cover both onBlur events and copy/paste into the field. Also you might want to modify your server side validation action so that it returns an ActionResult and JSON:

    public ActionResult ValidateHosFin(string hospitalFin)
    {
        // some validation logic
        if (hospitalFin == "1234567") 
        {
            return Json(true, JsonRequestBehavior.AllowGet);
        }
        return Json("invalid hospital fin", JsonRequestBehavior.AllowGet);
    }
    

    Another remark is your remote validation rule. You should make it return a function or the value sent to the server will be the value that the textbox had at the moment the page was shown (which is probably empty):

    $('form').validate({
        rules: {
            HospitalFinNumber: {
                required: true,
                minlength: 6,
                remote: function() {
                    return {
                        url: '<%= Url.Action("ValidateHosFin", "PatientACO") %>',
                        data: { hospitalFin: $('#HospitalFinNumber').val() }
                    };
                }
            }
        }
    });
    

    And here’s a live demo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the jQuery plugin Validation to validate a form. I have a select
I am looking for validation using jquery on a simple form and I want
I'm using the jQuery validation plugin to validate a form. The form fields are
I'm looking for a plugin for jQuery that can validate as a key is
I'm looking for a way to validate all the data on a form that
I'm looking to implement a zipcode field in django using the form objects from
I am learning jQuery right now and am looking to validate form fields with
I'm trying to validate a basic form, can i not use the standard validation
Which would be the best way to validate an upload form? Using the mime
I'm looking for a way to validate the SQL schema on a production DB

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.