Limiting input in FormFields [message #1003550] |
Mon, 21 January 2013 08:56  |
Eclipse User |
|
|
|
I have FormFields of various types (AbstractLongField, AbstractIntegerField, AbstractDoubleField, AbstractStringField) for which I want to limit the input. Some of the constraints I would like to enforce as the user types (and not only when he leaves the field and it is validated) are:
- suppression of non-numeric input in number fields
- suppression of digits in string fields
- limiting the number of characters that can be entered in a field
I've tried out some things, but can still not do all of the above:
- I can limit the number of characters accepted in a StringField by using getConfiguredMaxLength()
- I can validate any input after the field loses focus, I can return "sanitised" data after validation of throw an exception to indicate faulty input
- using the ValidateOnAnyKey property on StringFields I manage to trigger execValidateValue on each keypress, but I did not manage to write back a "sanitised" version of the rawValue (i.e. removing digits as they are typed) -> how do I do that?
- I have not found a way to limit the input length on numbers or to validate numbers as the user types (there is no ValidateOnAnyKey property on any of the number fields)
- I have managed to use the "Format" property on DateFields to define how I want dates to be formatted, but I have not found out how to use the "Format" property on any other field nor what the ValueFormat property of StringFields is used for
Is there any documentation on how to do what I want?
|
|
|
|
Re: Limiting input in FormFields [message #1003954 is a reply to message #1003858] |
Tue, 22 January 2013 05:16   |
Eclipse User |
|
|
|
Jeremie Bresson wrote on Tue, 22 January 2013 07:21Are you using Swing UI or SWT UI ?
My "Playground application" I use to learn all I can about Scout is using both Swing and SWT. Our "real" application will use SWT only.
Jeremie Bresson wrote on Tue, 22 January 2013 07:21have you see differences between both UI ?
=> If yes, one UI is probably not completely implemented and we need to fix it.
I've seen some differences between Swing and UI with regard to validation:
- StringField.execValidateValue without ValidateOnAnyKey (filtering out all input except for [A-Za-z]) works for both UIs when leaving the field
- StringField.execValidateValue with ValidateOnAnyKey (filtering out all input except for [A-Za-z]) is called after each keypress for both UIs, however the modified return value is not written back to the input field with either of them. When leaving the field, in SWT the value is then replaced, in Swing it isn't (but should be, I think)
- other than that, the two implementations seem to behave the same as far as I can tell
Jeremie Bresson wrote on Tue, 22 January 2013 07:21I am afraid that the kind of control you want to achieve requires
- Custom Fields and custom UI Renderer
- Modification of Scout
I think that you can do suggestions.[/quote]
Do you want me to make them here? Or should I open a bug report? (One of my colleagues has already opened a ticket for supporting ValidateOnAnyKey on Fields other than StringField (https://bugs.eclipse.org/bugs/show_bug.cgi?id=398283)).
The remaining suggestion would be that the mechanism of replacing the field contents with the return value of execValidateValue also function for ValidateOnAnyKey=true.
|
|
|
Re: Limiting input in FormFields [message #1005233 is a reply to message #1003954] |
Thu, 24 January 2013 12:26   |
Eclipse User |
|
|
|
I appreciate the time you have taken to make a deep test of scout. Sharing on the forum let us know you, your concerns, your vision from Eclipse Scout. It is very challenging.
I have given my opinion on bug 398283.
Urs Beeli wrote on Tue, 22 January 2013 11:16
Do you want me to make them here? Or should I open a bug report?
If you want to discuss something, or if you look for answers. The forum is the right place.
If you consider that something needs to be changed in the code (because it is a bug, or an enhancement request) a bug in bugzilla is necessary. Please add as much information as possible the bug (if necessary: minimal example, step to reproduce, platform...). This helps a lot to understand the request correctly.
You can also combine both approaches (if you link the bug and the forum post in both directions, there is no problem at all).
I can not assure you that every opened bug will be solved immediately, because there is a lot to do. But it is the only way to improve eclipse scout on the long term.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.25813 seconds