cancel
Showing results for 
Search instead for 
Did you mean: 

Change a standard Warning message

Former Member
0 Kudos

Hello all,

Here is my issue :

I'm using a type BigDecimal which is formated like this : 0.# so as to not allow the use of the " , " as a decimal separator.

Actually when a user use this " , " there is a warning message which is :

"Enter the value in the format -2733.3"

And I'd like to have a warning message such as : "Please use a number between 0 and 99.9"

I know I have to add a part of code to realize my own check but I don't know exactly how.

Thank you for your answer and your help.

Warm Regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

One dificult solution its that you make those elements Strings instead of BigDecimal.

then youll have to check whether or not the String its a propper Decimal. You could do that making your own definition using the String.match(). If its not what you want then you put your custom message.

Or you can use the libraries that ninit gave you for validation

public BigDecimal validate(String value, Locale locale)

Validate/convert a BigDecimal using the specified Locale.

Parameters:

value - The value validation is being performed on.

locale - The locale to use for the number format, system default if null.

Returns:

The parsed BigDecimal if valid or null if invalid.

After you check if it is a propper Decimal you have to convert the String to BigDecimal.

Its really nasty doing this ...

Also when you show the BigDecimal values, that must be for a currency, you have to change the . for , and viceversa so you have to use a String type again with a replace function or the java.util.Currency class

Another solutions are wellcome

Edited by: Jean Carlo Abreu on Jun 16, 2009 7:31 PM

Former Member
0 Kudos

Hello all,

Thank you for your answers.

Actually, I'm using the function isValid() to check if the BigDecimal format is well used. If it's not the case, I will display the warning message.

I'd like to know if an error message is always displayed before a warning message or all messages are displayed the one after the other?

Thank you.

Regards

Former Member
0 Kudos

all messages are displayed the one after the other. In the same sequense you send them

Answers (3)

Answers (3)

siddharth_jain
Active Contributor
0 Kudos

Hi

to override Webdynpro Framework validation declare your action without validation, check the check box without validation for your button's associated action and raise your custom message.

Siddharth

Former Member
0 Kudos

Thank you Siddharth for your answer.

But I'd like to know, if I remove the Framework validation check, I have to handle all the others issues which could occur. For example the special characteres : "(èà_- and others.

Is there an other way to manage this?

Thank you in advance.

Regards

Former Member
0 Kudos

Hi experts,

Thank you for your answers.

I tried the solutions you gave me but I still cannot change the standard error message so I tried to think about the issue from an other way.

The beginning of my problem is this :

- when a user enters data in a table cell, i.e. "4,5" , this value is automaticaly formated in "45" and when the user enters "4.5", the value isn't formated.

- I know that this is a problem of language preferences but I would like to go over thoses preferences.

What I would like is :

- replace the comma with a point when a data like "4,5" is entered

or

- give a format which accept both cases, the comma and the point.

Actually my simple type BigDecimal is defined like this : 0.#

And the build-in type of my simple type is Decimal.

I hope those information are enough to understand my problem.

Thank you for your help

nitin_mahajan2
Contributor
0 Kudos

There are some standard set of validators available in Java Open forums, you can download the APIs and use it as such..

These are available with apache, you can download these standard classes APIs and use in your code.

http://commons.apache.org/validator/apidocs/org/apache/commons/validator/routines/BigDecimalValidato...

http://commons.apache.org/validator/apidocs/index.html?org/apache/commons/validator/routines/package...

Regards,

Nitin