Solved

RegularExpressionvalidator Validor for a numeric entry in a textbox

Posted on 2007-12-04
2
1,360 Views
Last Modified: 2013-11-06
I have a textbox for which I allow only integers. How can I define a regularexpressionvalidator for this requirement.

Please help.
Thanks in advance.
0
Comment
Question by:VD1234
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Expert Comment

by:erikTsomik
ID: 20405119
try this  and attach the function to the textfield

function restrictChars(e) {
        var intKey;
        var restrictedKeys = new Array();
        
        //Set your restricted keyCodes from the URL I gave you
        restrictedKeys[0] = 8
        restrictedKeys[1] = 20
 
        if(window.Event)
            intKey = e.which;
        else
            intKey = e.KeyCode;
 
        for(var i = 0; i < restrictedKeys.length; i++) {
            if(intKey == restrictedKeys[i])
                e.returnValue = false;
            else {
                // Here is a sample check for numerics
                if(intKey > 47 && intKey < 58) {
                    // They pressed a number;
                    e.returnValue = false;
                }
            }
        }
    }

Open in new window

0
 
LVL 12

Accepted Solution

by:
Sinoj Sebastian earned 500 total points
ID: 20405263
use
ValidationExpression="\d+"
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question