Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: AW: [riena-dev] Comments regarding Validation

Title: RE: AW: [riena-dev] Comments regarding Validation

Hi Elias,

> you were right; I've fixed this:

> - ValidEmail and ValidExpression changed to be non-blocking. This fixed some issues with the example.

Something I messed up, thanks for fixing.

> Note that the point discussing some limitations of the current validation APIs still apply. In particular we should think about:
> - if validation time is decided by the rule implementer or the rule user

I'd vote for rule user (see my past comments on why I think this is the way to go).

> - if validation response (block, dialog, message, xyz) is decided by the rule implementer or the rule user

I'd vote for rule user, keeps rules more versatile.

> - how to react when invalid values are introduced programmatically via ridget.setText() / ridget.updateFromModel()

I'd vote for throwing an IllegalArgumentException, so the programmer can take action on this kind of problem, for example converting old data from the database to a new format. It also provides a stacktrace to fix the bug where it happens. I personally prefer not to have an issue ripple through the whole applicaton and see the bomb explode in some entirely other location, just because some other bug prevented this problem to be seen immediately in the ridget.
In the end ridgets can also be uneditable, so the user may see there's something wrong but not have any possibility to fix it manually, so we'd get bug reports like: "There's a questionmark in my date field and the application won't save any data, telling me it's broken", instead of a proper stacktrace.

> - if we want to update validation status when rules are added removed

That would be nice, wouldn't it? Alas "nice" does not necessarily mean "implemented in half an hour"..
So I guess I wouldn't vote for anything here :-).

I'd like to add the question

- do we really need "direct writing" in our ridgets?

 Updating the model could happen on enter, on focus transfer, on closing the form (which included closing the application), on navigation and on manual updates. I see that "direct writing" causes some problems, like either you must block temporarily incorrect input (which is frustrating to the user and may not work at all for regex-rules for example) or write to a buffer and only write the last valid buffer to the model on keypress (leaving values in the model, which are correct, but not the ones seen in the user interface). I guess not having something as "direct writing" would get rid of those problems. Is the benefit of direct writing worth the issues it raises?

Regards,
Wanja


Back to the top