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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:56:49+00:00 2026-06-17T00:56:49+00:00

I need to have a field that will not allow data to be inputted

  • 0

I need to have a field that will not allow data to be inputted if it returns a message of “false”. The field “ponumber” checks against a DB and if that record already exists I dont want it to allow the user to use that particular PO Number. Basically it blanks it out if they leave the field and displays the message. The script is working perfect except now allowing the input based on the false return from checkponumberajax php file.

            $(document).ready(function () {
              var validateponumber = $('#validateponumber');
              $('#ponumber').keyup(function () {
                var t = this; 
                if (this.value != this.lastValue) {
                  if (this.timer) clearTimeout(this.timer);
                  validateponumber.removeClass('error').html('<img src="/images/ajax-loader.gif" height="16" width="16" /> checking availability...');

                  this.timer = setTimeout(function () {
                    $.ajax({
                      url: 'includes/checkponumberajax.php',
                      data: 'action=check_ponumber&ponumber=' + t.value,
                      dataType: 'json',
                      type: 'post',
                      success: function (j) { 
                        validateponumber.html(j.msg);
                      }
                    });
                  }, 200);
                  this.lastValue = this.value;
                }
              });
            });

<input type="text" name="ponumber" value="<?=@$_REQUEST['ponumber']?>" id="ponumber" />

and my checkponumber.php file returns like this

if ($records != 0) {
    $response = array(
    'ok' => false, 
    'msg' => "The selected PO# is not available");
} else {
    $response = array(
    'ok' => true, 
    'msg' => "This PO# is free");
}

Edit: Solved!

I ended up thanks to @bourch using this which simply blanks out the field once a value is reached that matches false

if(j.ok != true){$("#ponumber").attr("value", "");}
  • 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-17T00:56:50+00:00Added an answer on June 17, 2026 at 12:56 am

    Try this:

    if(j.ok != true){$("#ponumber").attr("disabled", "disabled");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a field that will need to ALLOW HTML. It's 100% valid and
I need to ensure that a given field does not have more than one
I have a field that may be blank, so I need to use Object.try,
I have a database table with a field that I need to read from
Given a table in MySQL with rows that have a 'Country' field, I need
I currently have a SQL query that returns a number of fields. I need
I am writing a simple data warehouse that will allow me to query the
I have two fields that need to multiply each other and fill a third
I have a form that has a group of 3 text_fields. I need two
i have a text field in Contact screen and the user need to enter

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.