How to persist validation feedback messages on a page?

0
Situation: there are multiple questions on a form page, and most answers that are given by the user need to be validated. Some answers need to be validated for required-ness only (i.e. not being empty), but some need multiple validations like for required-ness and the format of the actual value itself (like being a valid IBAN). Each of these validations have specific validation feedback messages that need to be displayed when it doesn't pass (e.g. 'This is a required field' and 'This is an invalid IBAN').   Problem: whenever I validate a field, either through the Validation configuration option of the attribute on the page or by using an OnChange and/or OnLeave flow to do the validation, the validation feedback message disappears when the input field loses focus:     Question: is it possible to have a validation feedback message be displayed persistently until the validation actually passes, instead of it disappearing when the input field loses focus?
asked
3 answers
2

On Page Validation are not recommended by mendix . You can do validation by call a microflow on save . In microflow you can check condition is met or not than you can use validation feedback activity to show to validation. 

 

Hope this will help you.

answered
0

Hi Bart Zantingh,

 

Validate the data in a microflow upon clicking the save button instead of relying on OnChange or OnLeave events. Using decisions, you can check conditions and add a validation feedback activity if a condition fails. This approach will help you display validation messages when you click the save button, ensuring that you enter valid data based on the conditions specified for each field.

 

Hope this will help you.

 

answered
0

1 idea is a to have a 1 to 1 Helper entity associated to your source entity which has the for on it.

For each attribute you could have 1 1-1 association. The idea is to put a dataview BELOW each source entity attribute textbox or UI. (see the image below)

Screenshot 2024-05-21 at 10.49.52 AM.jpg

 

Screenshot 2024-05-21 at 10.51.27 AM.jpg

 

On change of any attribute you can setup individual MFs which fill the associated object and call a refresh. Till you clear the validation these will be there.

The dataview below each widget needs to be styled in a way to look like a validation feedback :) which is quite manageable.

The downside of this is, having to maintain a lot of MF;s :) and also each time a new attribute gets introduced you may have to do the additional work of making the onchange MFs, association to the NP object etc.

But definitely worth a shot of the time allows it :)

answered