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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:16:44+00:00 2026-05-22T16:16:44+00:00

i have a simple form with two fields whose data are being validated against

  • 0

i have a simple form with two fields whose data are being validated against a database on keyup with jquery. I am also having a button which is currently enabled or disabled based on the number of characters entered in these two fields. THe two jquery functions return an “accept” or “cancel” image for the two fields. I want to enable the button only if both the functions return the accept image or i can even make them return true along with it, which will not be a problem. I just wanna know how to compute a local result based on the returned value from two different ajax requests.

These are two functions that validate teh field against a database.

$("#agentName").keyup(function(){
        var agentName = $("#agentName").val();
        if(agentName.length > 3)
        {
            $("#agt-name-result").html(ajax_load).load(loadUrl, "val="+agentName+"&fld=agent_name");
        }
        else{
            $("#agt-name-result").html("<img src=\"images/cancel.png\" />");
        }
    });

    $("#agentSource").keyup(function(){
        var agentSource = $("#agentSource").val();
        if(agentSource.length > 9)
        {
            $("#agt-src-result").html(ajax_load).load(loadUrl, "val="+agentSource+"&fld=agent_url");
        }
        else{
            $("#agt-src-result").html("<img src=\"images/cancel.png\" />");
        }
    });

This is the function that validates the button

$("#agentName,#agentSource").keyup(function(){
        var validate;           
        var agentName = $("#agentName").val();
        var agentSource = $("#agentSource").val();
        if((agentName === "") || (agentSource === "") || (agentName.length < 3) || (agentSource.length < 10))
        {
            validate = false;
        }
        else { validate = true; }                   
        if(validate === true) { 
            $("#addAgntBtn").removeAttr("disabled");
            $("#addAgntBtn").removeClass("dialog-btn-disabled").addClass("dialog-btn");
        }
        else {
            $("#addAgntBtn").attr("disabled", "disabled");
            $("#addAgntBtn").removeClass("dialog-btn").addClass("dialog-btn-disabled");
        }
    });

Any ideas?

  • 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-22T16:16:45+00:00Added an answer on May 22, 2026 at 4:16 pm

    I would use a setInterval to poll a $.data() value in which the two ajax calls put their results. You have to pay attention to concurrent accesses, but it should work

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

Sidebar

Related Questions

I have a simple form all the fields work perfectly and the data is
i have a simple form with two input fields and i would like to
I have a simple in VB/ASP.NET form containing two text boxes, I am attempting
Have a simple form (only extract fields here) but for some reason the JQserilization
I have a simple ExtJS 4 (xtype form) inside a window. It has two
I want to make a simple FORM (not SQLFORM) in web2py with two fields
I have an asp page containing a form with two fields where the client
I have a very simple form with a name field and two submit buttons:
I have simple form. <form target=_blank action=somescript.php method=Post id=simpleForm> <input type=hidden name=url value=http://...> <input
I have a simple form on a view page, implemented as a user control,

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.