Problem is when I click New, and enter for example 123 in id textbox and click Save, then Validator doesn't show any error message (it validates if name is empty).
If I click New, and enter for example 123 in id textbox, and then press Tab and then click Save, Validator shows error messge.
If I remove @OnChange(OnChangeNamesIDAction.class) annotation then Validator works ok.
What is the problem?
Last edit: Mox 2021-06-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So the problem is not the validation, the problem is that because you move the mouse from the textfield to the button, on clicking on the button the event executed is the onchange event, and no the action asociated with the button.
Do you use the Save button on top or the one on bottom? Does it fail with both?
Help others in this forum as I help you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried this case, even using your above code as is, with OpenXava 7.6.1 and it works nicely. Now the validation message is shown when click on save, and both the validator and onchange action are executed. So, surely the bug was fixed laterally in some point since the version you were using to the current 7.6.1.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a problem that Validator doesn't get fired because of OnChange action, I don't know why.
This is my entity:
Problem is when I click New, and enter for example 123 in id textbox and click Save, then Validator doesn't show any error message (it validates if name is empty).
If I click New, and enter for example 123 in id textbox, and then press Tab and then click Save, Validator shows error messge.
If I remove @OnChange(OnChangeNamesIDAction.class) annotation then Validator works ok.
What is the problem?
Last edit: Mox 2021-06-09
Hi Mox,
In this case, the record is saved?
Help others in this forum as I help you.
No, it's not saved.
Hi Mox,
So the problem is not the validation, the problem is that because you move the mouse from the textfield to the button, on clicking on the button the event executed is the onchange event, and no the action asociated with the button.
Do you use the Save button on top or the one on bottom? Does it fail with both?
Help others in this forum as I help you.
It fails with both, but interestingly, it seems it works with Ctrl+S.
Last edit: Mox 2021-06-16
Hi Mox:
Well, when you click on an action from a field with an event, the action is not executed but only the event. Add it as a bug, I will revise the case.
Help others in this forum as I help you.
Hi Mox,
I tried this case, even using your above code as is, with OpenXava 7.6.1 and it works nicely. Now the validation message is shown when click on save, and both the validator and onchange action are executed. So, surely the bug was fixed laterally in some point since the version you were using to the current 7.6.1.