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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:47:31+00:00 2026-05-23T16:47:31+00:00

General Description : In my form, I have a field that requires remote validation.

  • 0

General Description:
In my form, I have a field that requires remote validation. In the remote call, I send the value of the form element as well as the values of a couple other form elements on which this element may depend (used on the server for validation).

The remote validation, when called, works great. The problem is that the remote validation is only called when there is a value in the form element. Depending on the params sent to the remote validation, this form element may be required or there may be other validation issues.

How can I force the remote validation on this field whether it has data in it or not?

Specific Scenario:
Got a roles list, and a salesperson code text input.
Server side logic: (1) if salesperson role selected, salespersoncode required; (2) if salesperson role not selected, salespersoncode must be empty.

Note that I do have other form element values I send to the server and there is other server side logic that I did not include here for brevity since they do not add value to this question and will only confuse things.

<select name="roles" id="roles" multiple="multiple" size="5"></select>
<input type="text" name="salespersoncode" id="salespersoncode" />

$("#add_user_form").validate({
  rules: {
    salespersoncode: {
      remote: {
        type: "post",
        url: "/AdminJson/CheckSalespersonCode",
        dataType: "json",
        data: {
            salespersoncode: function () { return $("#salespersoncode").val(); },
            roles: function () { return $("#roles").val(); }
        }
      }
    }
  }
}

I don’t want to put in the “required” validation option because the salespersoncode field is not required in all situations.

My question again: How can I force the remote validation on the salespersoncode field whether it has data in it or not?

Thanks in advance

  • 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-23T16:47:31+00:00Added an answer on May 23, 2026 at 4:47 pm

    Looks like you cannot have a form element that has remote validation without also having required validation.
    It ends up resulting in a dependency-mismatch.

    The very first line in the remote method is the check to see if it is optional – if it is optional, return a dependency-mismatch. (optional is the inverse of remote)

    The solution I came up with was to use a dependency-callback for the ‘required’ rule. In the function for the ‘required’ rule, call a synchronous ajax call to test the values in the UI on the server and return true/false.

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

Sidebar

Related Questions

Description I have a payment page that includes a form for entering bank account
I have an element that has two classes at all times: <p class=general_description laptop>
Here is the general description of my problem. I have folder for my favourite
It is my understanding that a module docstring should just provide a general description
General context : MVVM application. I have a View called JobView. Its DataContext is
general question is i like to build logger class that writes to single log
In general, what kinds of design decisions help an application scale well? (Note: Having
In general, I occasionally have a chain of nested macros with a few preprocessor
In general I think I can convey most programming related concepts quite well. Yet,
i have a question that is more design and architecture related. I am coming

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.