Subform Validation - Best Practices?
I'm pretty new to Subforms and looking for advice on the best way to validate Subform records. My preference is to always use the configurable features of the software and only drop into JavaScript if I absolutely have to.
I have 2 scenarios that I think might be common:
1) Entry of a value into a Subform field is invalid when compared to another Subform field. e.g. Qty On Hand = 10, Requested Qty entered as 11. I think I can validate this with a Rule on the Requested Qty field, It's only a warning and won't stop the submit, but I can set an ErrorsFound flag and test the flag in the Validation on Submit event to stop the Submit.
2) Only after all the fields have been entered (or not) in the Subform record do I want to validate the Subform record. I'd want to use the Before Submit event in the Rule Builder for this, and in the fields list it does shows me the Subform fields (appended with [this]), but the validation isn't working. I have 4 input fields and if all are left blank I want to throw an error. The error is thrown no matter if the fields are blank or have values. What I hoped would happen was that the Rule Builder is smart enough to recognize it's a rule against a repeating Subform and run the rule against each line in turn. i.e. with [this]=1, again with [this]=2, etc.
Any (hard won) advice on best practices appreciated...
PS. This is the Rule I hoped would work for 2).

請登入寫評論。
評論
1 條評論