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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:22:18+00:00 2026-06-08T05:22:18+00:00

Though it is a very common question. I have one input field in which

  • 0

Though it is a very common question. I have one input field in which the data entered must be between 1 and 150.

Problem is I am already using some validations on that. That validation is being used by many other input fields. So I cannot change that. It is the num() function.

On one field mesure I want to add extra functionality. I tried it with validate.
I don’t know how to merge these two validations for only one input field using both function in document.ready.

I can do it in either jQuery or PHP.

<input type="text" name='mesure' class="numbersonly" maxlength="3" onblur =" validate()"/>


function num() {

    $(".numbersonly").bind('keypress', function(e) {

        if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {

            $("#errmsg").html("numbers please");

            return false;
        }
    });

}

function validate()
{
   if( document.form.mesure.value >150 )
   {
       alert( "out of range!" );
       document.form.mesure.focus() ;
       return false;
   }
}      
  • 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-08T05:22:20+00:00Added an answer on June 8, 2026 at 5:22 am

    Why not using onkeypress/onkeyup, check it using the validate function.
    But remember that javascript is not the real solution for limitation – People can turn of or change the javascript. Also use php for checking the value.

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

Sidebar

Related Questions

Im very new to all coding including jquery. I though this would have been
Most of Knockout seems very intuitive. One thing that is strange to me though
I thought this could've been a common question, but it has been very difficult
I am very new to Javascript MVC frameworks and have a question related to
I have a very common situation. I have a file, and I need to
I have POSIX in mind for implementation, though this question is more about architecture.
I know this is a very common question, but I could not find the
I am very new to SSL,wants to install SSL for my application on GLASSFISH,though
though the code is a little long, most of them are very simple IMO.
The code here is X++. I know very little about it, though I am

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.