cancel
Showing results for 
Search instead for 
Did you mean: 

restircting the user to enter string values

Former Member
0 Kudos

hi

i have year range from and to with two

input fields ,

but how can i restrict string values to be entered in this

year range , i need only numeric values to be entered

Accepted Solutions (0)

Answers (2)

Answers (2)

piyush_kumar6
Active Contributor
0 Kudos

hi kishore shikore ,

set the data type of your value attribute "range" to integer.

if your value attribute "range" is of type integer

then no need to validate it for string , when ever user will

enter string value in that field at run time it will give error

automatically. just try

Former Member
0 Kudos

hi

thanks for the response

i dont want a runtime exception , i want to validate

and get the message from message pool

Former Member
0 Kudos

Hi,

set the data type of this attribute to integer.

OR


String val = wdContext.currentContextElement().getRange();
	  try{
		  Integer.parseInt(val);
	  }catch(NumberFormatException e)
	  {
		  //Not a valid number
	  }

Regards

Ayyapparaj