No announcement yet.
  • Filter
  • Time
Clear All
new posts

    Enum validator isOneOf has a list with the wrong values

    SmartClient Version: v13.0p_2022-04-26/Enterprise Deployment (built 2022-04-26)

    After upgrading to this new version (from 12.1) suddenly all our enum fields stopped working with the error "Not a valid option".

    We traced this back to the isOneOf validator for every enum field for every datasource having a list equal to the valueMap of one of our enum fields.
    The valueMap used as a list in all of the enum validators is this one, it is a field from our own Rule.ds.xml

    <field type="enum" name="rule_operator" title="" required="false" export="true" showInDetailViewer="false" allowEmptyValue="false" >
    <value ID="INCLUSIVE_BETWEEN">inclusiveBetween</value>
    <value ID="IS">is</value>
    <value ID="ONE_OF">oneOf</value>
    So every formitem with an enum field suddenly has this extra isOneOf validator with completely wrong values in the list. For example here we have another enum field from a different datasource having this extra isOneOf validator causing an error.

    Click image for larger version

Name:	image-2022-08-11-14-10-53-937.png
Views:	127
Size:	123.7 KB
ID:	268446
    Click image for larger version

Name:	image-2022-08-11-14-11-51-498.png
Views:	79
Size:	24.6 KB
ID:	268447

    Note: this only seems to happen once a form has been opened for our Rule.ds.xml, so opening this form somehow transforms the default isOneOf validator for enum fields.
    It seems to be done in the ISC_DataBinding.js resolveFieldOrPropertyType function, I will attach a stacktrace from during debugging.

    Click image for larger version

Name:	image-2022-08-11-14-16-16-108.png
Views:	67
Size:	353.5 KB
ID:	268448

    So my assumption is this overrides the default enum isOneOf validator by adding a list to it with the valueMap of our rule_oprator field but I am not sure why it is doing this.
    I checked the code of the smartgwt-enterprise-13.0-p20220426.jar!/com/smartclient/public/sc/modules-debug/ISC_DataBinding.js to get a readable version

    resolveFieldOrPropertyType : function(path, ruleScope) {
        var details = (ruleScope ? ruleScope.getRuleContextPathDetails(path) : null),
            field = (details ? details.field : null),
            type = (field ? isc.SimpleType.getType(field.type ? field.type : "text") : null)
        // If any of the validators require a valueMap (ex. isOneOf), apply the field's
        // valueMap to the validator's 'list' property so it can be properly validated and
        // not log a warning. Although the warning doesn't affect resolving the type it
        // litters the log with unwanted messages.
        if (type && type.validators) {
            var validators = type.validators;
            for (var i = 0; i < validators.length; i++) {
                var validator = validators[i],
                    validatorType = isc.Validator.getValidatorType(validator),
                    validatorDefinition = isc.Validator.getValidatorDefinition(validatorType)
                if (validatorDefinition && validatorDefinition.valueType == "valueSet" && field.valueMap) {
                    validator = isc.clone(validator);
                    validator.list = field.valueMap;
                    validators[i] = validator;
        return type;
    and noticed this extra validator check is new compared to older versions.

    I hope you can provide some insight, for now we have made a hacky workaround in our java code by overriding the validators of our enum SelectItems during the setInitHandler.

    Thanks for the report. We have committed a fix (removing the code in question) that will be available in nightly builds as of Aug 13 or later.

    Isomorphic Software


      Thanks for the quick response. We can confirm that this is fixed in the nightly build of Aug 13.