Hi Isomorphic,
thinking about the not triggered validation issue here and your statement here
I'm now wondering if BatchUploader should not simply always call validation for every change (or at least have an option to do so)?
It already has to call server validation when a serverCustom, isUnique, hasRelatedRecord or any other server validator is present for an edited field.
Now, if one overwrites validateRecord(), this is basically the same as if there was serverCustom validator on every field.
I don't know if "DataSource has a serverConstructor attribute" is enough to do so, because for me, every DataSource has this attribute. So I would not like this option. Can you find out with your DataSourceLoader if a DataSource's serverConstructor-class overwrites validateRecord()?
One workaround (for me) might be to define a serverCustom "TrueValidator" on every field, enforcing server validation for every change:
But this does not seem correct.
Does adding an option to the clientside BatchUploader seem like a good idea to you? With the option enabled, the BatchUploader would fire a validation request for every change in the grid. I don't think that this would be too expensive compute-wise as the BatchUploader (and editing in it) is not something something that is done very often.
This is also a bit important for me as I have a use case heavily depending on validateRecord(), but I think I can solve this with enforced validation though a "TrueValidator" for now.
Thank you & Best regards
Blama
thinking about the not triggered validation issue here and your statement here
Builtin per-field validation cannot be used in your use case, cause EitherOr custom validator is based on multiple fields. You should subclass from the DataSource (SQLDataSource or which you are using) and override new API to add this kind of validation. See javadocs for details.
It already has to call server validation when a serverCustom, isUnique, hasRelatedRecord or any other server validator is present for an edited field.
Now, if one overwrites validateRecord(), this is basically the same as if there was serverCustom validator on every field.
I don't know if "DataSource has a serverConstructor attribute" is enough to do so, because for me, every DataSource has this attribute. So I would not like this option. Can you find out with your DataSourceLoader if a DataSource's serverConstructor-class overwrites validateRecord()?
One workaround (for me) might be to define a serverCustom "TrueValidator" on every field, enforcing server validation for every change:
Code:
public class TrueValidator { public boolean condition(Object value, Validator validator, String fieldName, @SuppressWarnings("rawtypes") Map record, DataSource ds) throws Exception { return true; } }
Does adding an option to the clientside BatchUploader seem like a good idea to you? With the option enabled, the BatchUploader would fire a validation request for every change in the grid. I don't think that this would be too expensive compute-wise as the BatchUploader (and editing in it) is not something something that is done very often.
This is also a bit important for me as I have a use case heavily depending on validateRecord(), but I think I can solve this with enforced validation though a "TrueValidator" for now.
Thank you & Best regards
Blama
Comment