I'm having a small problem with one of the things I am attempting. I want a validation function to detect if an object is set as active. It works but if I save an inactive record, leave, come back it to, then set it active I can get past the validation.
This is because it's only detecting the value the checkbox is connected to, and not whether the checkbox itself is clicked. How can I accomplish that, as getting the id of the html element and trying it through javascript does not work.
Thanks
Like
2 comments
02:13 Nov 08, 2018
Here is an example of replacing page with validation function for checkbox:
define("OrderPageV2", [], function() { return { entitySchemaName: "Order", methods: { isActiveValidator: function() { var invalidMessage = ""; if (this.get("UsrActive") === true && this.get("Status").displayValue === "4. Completed") { invalidMessage = this.get("Resources.Strings.ValidationString"); } return { invalidMessage: invalidMessage }; }, setValidationConfig: function() { this.callParent(arguments); this.addColumnValidator("UsrActive", this.isActiveValidator); this.addColumnValidator("Status", this.isActiveValidator); } }, diff: /**SCHEMA_DIFF*/[ { "operation": "insert", "parentName": "Header", "propertyName": "items", "name": "UsrActive", "values": { "caption": {"bindTo": "Resources.Strings.IsActiveCaption"}, "layout": { "column": 0, "row": 5, "colSpan": 12 } } } ]/**SCHEMA_DIFF*/ }; });
If it didn't help you give us please full code of your page "methods" section.
Show all comments