Custom validation

0
Hi, I would like to create a custom validation on my textbox to validate the user input. Currently I have the options “Required”, “E-Mail” and “Custom”: I would like to create my own validation type, let’s say “Negativ number”, and have this new type available in the drop down list on all my text boxes in my application. How can I create a custom validation type for the text box?
asked
3 answers
2

That's not the intended use of front-end validation. The custom option only allows you to create an expression that will be checked.

If you want to make a custom validation, it's best to do it in a microflow, and place it under the save button.

https://docs.mendix.com/howto/data-models/setting-up-data-validation#5-advanced-validation-with-a-custom-save-button

answered
0

I partially agree with Lennart. You could do the validation in a microflow in a save flow, but if you want to provide the user with immediate feedback you could also easily build an on change microflow. You can do this in the “Events” tab.

What would probably also be better and even better: use a nanoflow in stead of a microflow. Then the validation is done client side. Use a ‘validation feedback’ message to show the validation on the right attribute.

answered
0

I am facing trouble doing a consistent validation. I think the correct way, like Jord said, is validating client side via nanoflow and server side via microflow. But with complex validation logic using Actions, I need to implement it either in Javascript and Java.

answered