We do this using Java Script as follow
function isCurrency(userEntry) {
var decimalPoint = /\./;
var digitsAfterDecimal = /\..{1,2}$/;
if (decimalPoint.test(userEntry) == true){
if (digitsAfterDecimal.test(userEntry)==false)
return false;
else
return true;
}
else
return true;
}
if (isCurrency(txtAmount) == false){
alert("Item price should have only 2 digits
after decimal point");
frmDelivery.txtPrice.focus();
return false;
}
if ( ((((txtAmount).indexOf('.')) == -1) &&
(txtAmount.length > 11))
|| (((txtAmount).indexOf('.')) >
11)){
alert("Item price is too big ");
frmDelivery.txtPrice.focus();
return false;
}
Trust this will help
Have a nice day
Balkrishna R Parab
Global TeleSystem Ltd
Although Champions dont always win, winners ,it seems always have champions.
-----Original Message-----
From: Carol Geng [SMTP:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 12:43 PM
To: [EMAIL PROTECTED]
Subject: [JSP-INTEREST] To check the field
All,
Anyboyd would like to share how easy to check the field which is
string but
only 1 or 1.0 or 2.1 such data can be entered.
I could do it if I put the data field as number(10,1) something, but
it can
not be retrieved from the perl script.
So I put the data field as varchar2 (oracle db), and now I need to
validate
the data entry in the user interface.
User can not put string 'a', or 'a.a' .
Thanks,
Carol
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set
JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets