cancel
Showing results for 
Search instead for 
Did you mean: 

numeric validation

Former Member
0 Kudos

Hi

I have a input field with label MILES where it should accept only numeric values(like 12,145.345,0.3435...)can you please tell how to write validation for this

Thanks

Raju

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Create this input type as integer and format it as per your requirement

Either create a dictionary type and specify the format

or else use the DecimalFormat

Ex:



DecimalFormat decimalFormat = new DecimalFormat( "#,###,###,##0.00" );
double val= 100.23297;
System.out.print(decimalFormat.format(val));

Regards

Ayyapparaj

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Raju,

Create a context attribute and select "type" property of the attribute as integer from the drop down.

On the Layout tab create an input field and map the input field's value property to this context attribute.

Create an action button say Save and write the save code on its action.

Now if you put alphabets or alphanumeric value in the input field and click on save button the input field will come in red and message will be displayed "Value contains non-numeric charcters". This is a built - in numeric check in Dynpro.

PradeepBondla
Active Contributor
0 Kudos

Hi,

your own thread having some question and solutions

are you facing any problem even? let us know is it solved or not.

PradeeP