Hello,

Apache Wicket version used: 8.12.0

I need to show total characters entered into First, Middle and Last name
text fields + one drop down for Suffix. The combined length of these four
fields should not exceed the set limit.
For this, I have added OnChangeAjaxBehavior to all the three text fields +
the drop down.

These fields are bound to the respective bean properties using
CompoundProperyModel. The bean has a generic getter method to calculate
combined length without trimming white space from any field.

Issue:
The CompoundPropertyModel bean setter method is not called when a white
space is entered after any letter in the field.
For example, entering "f" in the first name will call the setter method,
but entering white space after "f" does not call the setter method until
the next character is entered.
This is messing up the total chars count.

Here is how the length looks like without any white space trimming:

(1) F + M + L = "f" + "m" + "l" = 3
(2) F + M + L = "f " + "m" + "l" = 3 (Please note the white space after f)
(3) F + M + L = "f n" + "m" + "l" = 5

As one can see, the 2nd scenario is what I am trying to solve.

The OnChangeAjaxBehavior event is called when entering the white space, but
the bean setter is not, causing misleading total chars count.

Any suggestions?

Thank you,
-Mihir.

Reply via email to