07-20-2023, 05:34 AM
The specific case I've got in mind is as follows: an AjaxFormComponentUpdatingBehavior("onchange") is added to a TextField<String> in a form. The behavior **verifies the text for certain conditions** (either the model object or the form component model, doesn't matter), based on which it **might display a message** (or hide it, if it has already been shown).
The problem is, there are also validators added to the TextField. One of the possible (and likely) scenarios consists of the user typing in, **first, a value that causes the message to be displayed** by the AJAX request. If, then, he/she types in a **value that doesn't pass validation**, the **message should disappear**, but it does not.
Apparently, either the **onUpdate() method for the AJAX behavior is not called at all**, or I am failing in my attempts to insert a **check for non-validated entries** (I have tried to test for both null values and empty strings, to no avail; I have no idea what exactly Wicket's validators do to models when data is invalid).
I am wondering if someone who actually understands validators (or AJAX, actually) has any ideas on where the problem could be.
I can post edit and post code if someone tells me this is not a general issue tying validators and AJAX, but most likely a programming mistake. I still believe the former and thus I'll refrain from posting code sections, in order to keep the discussion on an API/theoretical frame.
Thanks.
The problem is, there are also validators added to the TextField. One of the possible (and likely) scenarios consists of the user typing in, **first, a value that causes the message to be displayed** by the AJAX request. If, then, he/she types in a **value that doesn't pass validation**, the **message should disappear**, but it does not.
Apparently, either the **onUpdate() method for the AJAX behavior is not called at all**, or I am failing in my attempts to insert a **check for non-validated entries** (I have tried to test for both null values and empty strings, to no avail; I have no idea what exactly Wicket's validators do to models when data is invalid).
I am wondering if someone who actually understands validators (or AJAX, actually) has any ideas on where the problem could be.
I can post edit and post code if someone tells me this is not a general issue tying validators and AJAX, but most likely a programming mistake. I still believe the former and thus I'll refrain from posting code sections, in order to keep the discussion on an API/theoretical frame.
Thanks.