on 03-05-2012 8:19 AM
Hi all,
I have an InputField with a corresponding integer simple type that is not nullable. The inputfield has state required. The problem is, when the user removes all characters from the the inputfield and presses a button, WebDynpro will automatically set the value to '0'. The values will now be written into the database, even if the user does not wanted to use '0' as value. The "required" state does not work in this case.
is there a way to distinguish between an empty InputField and the value '0' in the field, if the corresponding simple type is an integer?
Cheers,
Tobit
I don't think so - backing type is primitive integer, which have default start value 0 and don't have "null" value.
Try with to assign type com.sap.dictionary.predefined.objecttypes.integerObject to as a context attribute type.
or you can use string type and do needed conversion in your logic.
Regards,
Jacek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the reply. Even if I don't understand why that works (the object version is also presented as a simple type...) it is very useful. But my next problem is: How can I configure minimum and maximum values on that integerObject datatype, so that the user input is automatically validated by the Web Dynpro framework?
Cheers,
Tobit
With "not null" there will be always initial value written to a database
http://help.sap.com/saphelp_nwce10/helpdata/en/9c/1c713eeaac5441e10000000a114084/content.htm
integerObject initial value is null and, in turn, it gives empty string as initial value.
So you can use primitive integer and make some additional logic in code responsible for database save or use integerObject and add custom validation.
Regards,
Jacek
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.