How to check the value in the text field is not a number

Showing Answers 1 - 2 of 2 Answers

Hi Alwin,

1. If you are using struts framework, you can specify what that text field should hold to be valid. It should be specified in validation.xml file. You can specify regular expression as that fits your requirements.

2. If you want only client side validation, then you can validate the value of that text field with the help of javascript. It has function isNaN().

Hope this helps.

Thanks

-ashruf

  Was this answer useful?  Yes

satya211

  • May 17th, 2006
 

Use this

onblur=mask(this.form.acno) //acno is field name

function mask(val)
{
  if(isNaN(val.value))
  {
    alert("Not a number");
    val.focus();
    val.select();
  }
}

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions