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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:41:27+00:00 2026-06-01T18:41:27+00:00

I want to validate that a number has certain parameters, for example I want

  • 0

I want to validate that a number has certain parameters, for example I want to ensure that a number has 3 decimals is positive. I have searched in different places over the internet, although I could not find how to do it. I have made that text box to accept numbers only. I just need the rest of the features.

Thanks,

$("#formEntDetalle").validate({
                    rules: {

                        tbCantidad: { required: true, number: true },
                        tbPrecioUnidad: { required: true, number: true },

                    }
                    messages: {

                        tbCantidad: { required: "Es Necesario Entrar una cantidad a la orden" },
                        tbPrecioUnidad: { required: "Es Necesario Entrar el valor valido para el producto" }

                    },
                    errorPlacement: function(error, element) {
                        parent = element.parent().parent();
                        errorPlace = parent.find(".errorCont");
                        errorPlace.append(error);
                    }
                });

I want to control that text box with something like:

$.validator.addMethod('Decimal',
                    function(value, element) {
                       //validate the number
                    }, "Please enter a correct number, format xxxx.xxx");
  • 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-01T18:41:28+00:00Added an answer on June 1, 2026 at 6:41 pm

    Based on the examples here:

    $.validator.addMethod('Decimal', function(value, element) {
        return this.optional(element) || /^\d+(\.\d{0,3})?$/.test(value); 
    }, "Please enter a correct number, format xxxx.xxx");
    

    or with commas permitted:

    $.validator.addMethod('Decimal', function(value, element) {
        return this.optional(element) || /^[0-9,]+(\.\d{0,3})?$/.test(value); 
    }, "Please enter a correct number, format xxxx.xxx");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp:TextBox and I want to validate that the number of characters
I am using RegexKitLite, i want to validate that my uitextfield has + prefixed
I have a Query class that has a number of properties that are collections
I want to validate user-input. If the number user has entered is greater than
I have a case where I want to validate an entered vat number. Each
I want a regular expression that validate a string that allow only numbers and
If I want to validate that a text box contains an integer greater than
I want to validate a registration form that accepts an email address in the
In Zend_Form i want to validate for duplicate records that might exist in database.
Basically I want to develop a BHO that validates certain fields on a form

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.