Solved

RegularExpressionvalidator Validor for a numeric entry in a textbox

Posted on 2007-12-04
2
1,358 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
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.

735 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