cancel
Showing results for 
Search instead for 
Did you mean: 

Validation for numeric only

former_member187658
Participant
0 Kudos

Hi

I want to put the validation so tht the number entered should only be numeric. I cannot define it as int because i am using it in other validations also and for them i am using it as string. Is there a way through coding in which we can put this validation?

Thanks & regards,

Anupreet

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

One way is to use Integer.parseInt(String) it would return exception if it is non numeric. Handle the Exception.

former_member187658
Participant
0 Kudos

Hi Noufal

Thank you. I was able to solve the issue with your suggestion.

Thanks & regards,

Anupreet

Answers (2)

Answers (2)

former_member182372
Active Contributor
0 Kudos

What kind of "other validations" are you using?

Former Member
0 Kudos

Hi Anupreet,

As far as I know , there doesn't exists any inbuilt function to check validate the input as per your requirement. (But why do you need an attribute that accepts both numebrs & strings and then check whether it is numeric ?)

A small suggestion is to write your own Java function for the said validation. Call this function to validate your input.

Hope this helps,

Best Regards,

Nibu.