Hi Isomorphic,
please see this BuiltInDS based testcase (using v10.1p_2016-03-07):
Change to employees.ds.xml:
FalseValidator.java:
Open standard BuiltInDS sample and try to edit employees.Job (title="Title"). This will call validation for every change, except if you try to delete the value.
IMHO also setting to null should trigger validation, as the serverObject could determine the outcome on other fields/conditions as well.
I read this post of yours in an older discussion, but this was about calling all validators for every change. Here the very field where on which the validator is defined changes.
Best regards
Blama
please see this BuiltInDS based testcase (using v10.1p_2016-03-07):
Change to employees.ds.xml:
Code:
<field name="Job" title="Title" type="text" length="128"> <validators> <validator type="serverCustom"> <serverObject lookupStyle="new" className="com.smartgwt.sample.server.listener.FalseValidator" /> <errorMessage>$errorMessage</errorMessage> </validator> </validators> </field> [B][/B]
FalseValidator.java:
Code:
package com.smartgwt.sample.server.listener; import java.util.Map; import com.isomorphic.datasource.DataSource; import com.isomorphic.datasource.Validator; import com.isomorphic.log.Logger; public class FalseValidator { public boolean condition(Object value, Validator validator, String fieldName, @SuppressWarnings("rawtypes") Map record, DataSource ds) throws Exception { Logger log = new Logger("com.isomorphic." + FalseValidator.class.getName()); log.info("Called for field \"" + fieldName + "\", value \"" + (value == null ? "NULL" : value.toString()) + "\""); validator.addErrorMessageVariable("errorMessage", "FalseValidator"); return false; } }
IMHO also setting to null should trigger validation, as the serverObject could determine the outcome on other fields/conditions as well.
I read this post of yours in an older discussion, but this was about calling all validators for every change. Here the very field where on which the validator is defined changes.
Best regards
Blama
Comment