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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:42:25+00:00 2026-06-11T19:42:25+00:00

I am having difficulty trying to get my field to validate using the remote

  • 0

I am having difficulty trying to get my field to validate using the remote rule with jQuery Validation. It is making the ajax call fine and passing the correct data. The Web service is operating fine and is returning a true or false as needed.

My problem comes in that the rule always stays negative. I am not sure if maybe I am returning the true/false in the incorrect format. Ideas/thoughts?

This is my rule:

$("[id$=txtOther]").rules("add", {
    remote: function () {
        return {
            type: "POST",
            url: $("[id$=hBaseURL]").val() + "Webservice/Validation.asmx/ValidateUser",
            data: JSON.stringify({ FullName: $("[id$=txtOther]").val(), UserID: $("[id$=txtOtherID]").val() }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            cache: false,
        };
        },

    messages: {
        remote: ""
    }
});

And this is how my web service is responding:

d       [Object {__type="Validation+Results", Status="true"}]
0       Object {__type="Validation+Results", Status="true"}
Status  "true"
__type  "Validation+Results"
  • 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-11T19:42:26+00:00Added an answer on June 11, 2026 at 7:42 pm

    Well, this is what I ended up having to do to fix the problem. First I took what Andrew said and found more out there to support what he was saying. The most helpful was this post:

    Problem with jQuery validate plugin (remote validation)

    This post basically added these lines to my existing code:

    dataFilter: function (data) {
        var x = (JSON.parse(data)).d;
        return JSON.stringify(x); 
    }  
    

    The problem was still there though. I started thinking about what could be wrong and started to wonder about my web service and how it was returning other than the .d response. I had used different modifications of this web service for some time now, but for some reason this one was not working. After looking a bit more at it I thought about the fact that it was returning a list of values since that is what I needed everywhere else. I was only returning one item in that list, but I was wondering what would happen if I returned just that item instead of the list. My web service now returned this:

    {"d":"true"}
    

    This still did not work with my original code, but now I was fairly certain it was because it was returning as d. The dataFilter I found at the other site was still not allowing it to work so I modified the dataFilter a little bit to return just plain text like this:

    dataFilter: function (data) {
        var x = (JSON.parse(data)).d;
        return x;
    }
    

    Finally I had a solution that was working. During this process I ran into issues with getting the validation to trigger again after it failed, or supposedly returned true even though it was in error. There is a lot more information out there about this and since that wasn’t the original question I won’t go into all of that. One helpful post was:
    jquery validation – remote method won't trigger after valid However, just because they are so related I used this code to reset the validation allowing the validation to be triggered again even with a recent true valid call.

    $("[id$=txtOther]").removeData("previousValue");
    

    I am still using this code along with the following code to trigger the validation on demand:

    var resetValid = $("[id$=txtOther]").valid();
    

    This is my final code for the remote validation:

     $("[id$=txtOther]").rules("add", {
        remote: function () {
            return {
                type: "POST",
                url: $("[id$=hBaseURL]").val() + "Webservice/Validation.asmx/ValidateUser",
                data: JSON.stringify({ FullName: $("[id$=txtOther]").val(), UserID: $("[id$=txtOtherID]").val() }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                cache: false,
                dataFilter: function (data) {
                    var x = (JSON.parse(data)).d;
                    return x;
                }
            };
        },
        messages: {
            remote: "Additional reviewers must be selected from available options"
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using REGEXP_SUBSTR in Oracle 11g and I am having difficulty trying to
I'm having difficulty using MooseX::Declare properly when calling BUILDARGS. I'm trying to create an
I am having difficulty trying to get modernizer to run with codeigniter. this is
I'm using the Joda-Time library with Java. I'm having some difficulty trying to turn
I'm having some difficulty trying to get Jackson to serialize/deserialize JSON date strings sent
I am having difficulty trying to get a very simple scenario working with PRISM
I'm trying to get Cabal to install the haskell-src-meta package, and I'm having difficulty
I'm having an epic amount of difficulty trying to get a result from a
I'm trying to get a following target value by using NSPredicate. But, I'm having
I'm trying my hand at creating an AJAX search and having some difficulty. Here's

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.