I have a function working here now:
function isVerFormat(sVer) {
var DotPos = sVer.indexOf(".",0);
var valid = true;
if (sVer.length == 0) {
valid = true;
return valid;
}
while (DotPos>0)
{
var sVerLeft = sVer.substring(0,DotPos);
var sVerRight = sVer.substring(DotPos + 1);
if (sVerLeft < "0" || sVerLeft > "9")
{
valid = false;
DotPos = 0;
}
else
{
sVer = sVerRight;
DotPos = sVer.indexOf(".",0);
}
}
if (valid == true)
{
if (sVer < "0" || sVer > "9")
valid = false;
}
if (valid == false)
{
alert("the data format is not correct.");
document.forms[0].elements["ver"].value = "";
document.forms[0].elements["ver"].focus();
return false;
}
return true;
}
At 09:45 AM 3/21/2001 +0530, you wrote:
>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
===========================================================================
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