Hi Isomorphic,
I'm developing a BatchUpload, where the user can import main entries with child-detaildata.
Some fields on both the masterdata/maindata and the child-detaildata are mandatory. The masterdata fields I just mark as required=true.
I can't do that for the child-detaildata fields, as a row with just masterdata is also OK.
So I need to validate that if one of the child-detaildata fields has data, all mandatory child-fields also have data.
This sounds like the perfect usecase for ValidatorType.REQUIREDIF.
Could you give an example of ValidatorType.REQUIREDIF usage in .ds.xml? The docs don't really help me.
Questions (besides the example):
This says three parameters, but then lists four. Also, how do I specify and write the method?
Does this mean that the validator is client-only?
I looked it up in the LGPL and EE showcase samples, but could only find one sample, where the validator is used in Java, not in .ds.xml.
I could easily roll this as server-custom validator in Java, but then it is serverOnly and always needs a server hit.
Thank you & Best regards
Blama
I'm developing a BatchUpload, where the user can import main entries with child-detaildata.
Some fields on both the masterdata/maindata and the child-detaildata are mandatory. The masterdata fields I just mark as required=true.
I can't do that for the child-detaildata fields, as a row with just masterdata is also OK.
So I need to validate that if one of the child-detaildata fields has data, all mandatory child-fields also have data.
This sounds like the perfect usecase for ValidatorType.REQUIREDIF.
Could you give an example of ValidatorType.REQUIREDIF usage in .ds.xml? The docs don't really help me.
Questions (besides the example):
RequiredIf type validators should be specified with an expression property set to a stringMethod, which takes three parameters
To allow server-side enforcement, a required validator can be used instead.
I looked it up in the LGPL and EE showcase samples, but could only find one sample, where the validator is used in Java, not in .ds.xml.
I could easily roll this as server-custom validator in Java, but then it is serverOnly and always needs a server hit.
Thank you & Best regards
Blama
Comment