Required property on custom widget

1
I have a custom widget that basically acts as a dropdown reference selector and I want to add the property "required" to it, so the user won't be able to save the context object of the dataview and commit to the database if no option was selected in the widget. But I haven't found anything about it in the documentation, any ideas? (or links)
asked
2 answers
4

The actual validation logic should really take place outside of your widget. You can configure your widget to handle and display validation feedback provided to it, just like the built-in widgets do. The widget boilerplate example should handle displaying feedback, and I believe the test project has a page to test this out.

As for setting up your validation logic, see here: https://world.mendix.com/display/public/howto50/Setting+up+data+validation

answered
1

Mendix in general inherits from the Dijit/Dojo framework. You could try setting up your widget using the Dijit documentation for Form and ValidationTextBox

http://dojotoolkit.org/reference-guide/1.10/dijit/form/Form.html#dijit-form-form

http://dojotoolkit.org/reference-guide/1.10/dijit/form.html#dijit-form

http://dojotoolkit.org/reference-guide/1.10/dijit/form/ValidationTextBox.html#dijit-form-validationtextbox

answered