struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henrique VIECILI" <viec...@softplan.com.br>
Subject Re: validate numeric
Date Thu, 20 May 2004 13:58:47 GMT
Hi Julia,

You can use javascript and/or server-side validation:

javascript:

isNaN(field.value); //verify if the value 'is not a number'

server side: (there are many ways)

try {
    Double.parseDouble(getField());
} catch (NumberFormatException nfe) {
    // if this exception is thrown the value of the field is not a number
}


[]´s
Henrique Andrade Viecili
  ----- Original Message ----- 
  From: Julia Weaver 
  To: Struts Users Mailing List ; seandynan@bigfoot.com 
  Sent: Thursday, May 20, 2004 9:56 AM
  Subject: validate numeric


  Hi,

  How can I validate the field user input in form bean
  is not a numeric value? Is any function exist like: 
  IsNumeric(x)?

  Thanks, 




  __________________________________
  Do you Yahoo!?
  Yahoo! Domains - Claim yours for only $14.70/year
  http://smallbusiness.promotions.yahoo.com/offer 

  ---------------------------------------------------------------------
  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
  For additional commands, e-mail: user-help@struts.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message