Line break or control characters validation / filtering

In many fields of the databases I don’t allow input when line breaks are entered (this happens when a user is copy and pasting content from a web page or a word document into the field in Servoy).

The way I’ve been managing this is by table/validation using regex.

For instance, I am using the following regex expression to match any character, except the line break characters:

^.*$

If it does not match, the error “Invalid input, Validation failed” is triggered and the data input is rejected.

I really don’t need the validation. If there are no line breaks characters nothing happens anyway. All I need to do is remove the line break characters (or control characters) any time the user enters data into those fields. Can anyone tell me the most effective way to do this in Servoy?

You advice will be appreciated!

JC

Have you tried the onDataChange event.?

I think that’s the way of doing it, but I haven’t tried yet.

I was expecting an easy solution; something that could be done by just setting the property of an element field.

For instance, it’d be nice if by setting the displayType property = TEXT_FIELD, the data paste in there will always remove the line break character enter in a copy and paste.

Notice that property set for TEXT_FIELD never allows the Enter or Return key stroke to insert the line break. This is correct. By default, the element setting displayType property = TEXT_FIELD should remove or not allow line breaks. (If line breaks are needed, we always can use TEXT_AREA).

Should this be a feature request?

JC