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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:26:39+00:00 2026-06-12T05:26:39+00:00

How do I ensure that a user cannot enter a value smaller or bigger

  • 0

How do I ensure that a user cannot enter a value smaller or bigger than a certain value ?

The problem lies in making a validation of a field having a value smaller or bigger than another field.

  • 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-12T05:26:40+00:00Added an answer on June 12, 2026 at 5:26 am
        $(document).ready
    (
        function ()
        {
            $.validator.addMethod(
            "greaterThan",
            function (value, element, param)
            {
                // bind to the blur event of the target in order to revalidate whenever the target field is updated            
                var target = $(param)
                .unbind(".validate-greaterThan")
                .bind
                (
                    "blur.validate-greaterThan", 
                    function ()
                    {
                        $(element).valid();
                    }
                );
                return parseFloat(value) >= parseFloat(target.val());
            },
            "Pretul trebuie sa fie mai mare decat valoarea initiala"
            ); 
        }
    );
    
    
    
    $('#gvProduseList input[name$=Pret]').each
        (
            function (index, domEle)
            {
                $(this).rules
                (
                    "add"
                    , {
    
                        required: true,
                        minlength: 1,
                        range: [0.1, Number.MAX_VALUE],
                        greaterThan: '#Produse_' + index + '__PretIntrare',
                        messages: 
                        {
                            required: "Pretul este necesar!",
                            minlength: "Pretul este necesar!",
                            range: "Pretul este necesar!",
                            greaterThan: "Pretul trebuie sa fie mai mare decat " + $('#Produse_' + index + '__PretIntrare').val()
                        }
                    }
                );
            }
        );
    
    
    
    
    $(document).ready
    (
        function ()
        {
            $.validator.addMethod(
            "lessThan",
            function (value, element, param)
            {
                // bind to the blur event of the target in order to revalidate whenever the target field is updated            
                var target = $(param)
                .unbind(".validate-lessThan")
                .bind
                (
                    "blur.validate-lessThan",
                    function ()
                    {
                        $(element).valid();
                    }
                );
                return parseFloat(value) <= parseFloat(target.val());
            },
            "Valoarea trebuie sa fie mai mica sau egala decat valoarea initiala"
            );
        }
    );
    
    
     $('#gvListDetaliiElemTranAdaugare input[name$=Valoare]').each
        (
            function (index, domEle)
            {
                $(this).rules
                (
                    "add"
                    , {
    
                        required: true,
                        minlength: 1,
                        range: [0.1, Number.MAX_VALUE],
                        lessThan: '#ListaDetaliiElemTranModelAdaugare_' + index + '__ValoareRamasa',
                        messages:
                        {
                            required: "Valoarea este necesara!",
                            minlength: "Valoarea este necesara!",
                            range: "Valoarea este necesara!",
                            lessThan: "Valoarea trebuie sa fie mai mica sau egala cu " + $('#ListaDetaliiElemTranModelAdaugare_' + index + '__ValoareRamasa').val()
    
    
                        }
                    }
                );
            }
        ); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I do some form validation to ensure that the file a user uploaded is
I am on creating a system, I am trying to ensure that user cannot
I need to ensure that the user login form for Drupal can not be
What is the best way to ensure that a user who wants to install
I have the following code to ensure that if the user selects the same
Seems to me for simple forms that only require the user to ensure a
I'm writing validation regex in c# - basically need to ensure that property does
I have a field that a user can input first and last name to
I'd like to ensure that when a user wants to register a username in
My ViewModel has validation attributes that ensure that it wont be empty etc. -

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.