on 06-16-2009 4:28 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Regards,
Nitin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.