Announcement

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

  • Not able to bring the error icon

    1. Smartclient version v9.1p_2015-02-05/Pro Deployment (built 2015-02-05)

    2. Browser Chrome Version 40.0.2214.115 m

    3.
    Code:
    isc.DynamicForm.create({
        width: 300,
        fields: [
            {name: "fullName",
             type: "text",
             title: "Full Name",
             defaultValue: "Billy Bob",
             validateOnChange:true,
    
                            validators: [{type:"dateCustom",errorMessage:"this is error message",
                                clientOnly:true,
                                validateOnChange:true,
                            condition:function(item, validator, value, record){
    //just returning false for test purposes                        
    return false;
                        }}]
            },
            {name: "licenseAccept",
             type: "checkbox",
             title: "I accept the agreement",
             change: "form.getField('proceed').setDisabled(!value)"
            },
            {name: "proceed",
             type: "button",
             title: "Proceed",
    		 width:100,
             click: "isc.say('OK')",
             disabled: true
            }
        ]
    });
    The above code is a modified version of http://www.smartclient.com/docs/9.1/...dEnableDisable , to introduce an error icon just beside the text field.

    In our case we have some similar code -

    Code:
    rangeDialogDefaults: {
            _constructor: "DateRangeDialog",
            autoDraw: false,
            mainLayoutDefaults: {
                _constructor: "VLayout",
                width: "*", //This is overridden to allow smaller width
                height: 105,
                layoutMargin: 5
            },
            rangeItemDefaults: {
                _constructor: "DateRangeItem",
                allowRelativeDates: false,
                invalidRangeErrorMessage: "Invalid Range",            showTitle: false,
                showHint:false,
                           fromFieldProperties:{
                    width:180,//Default width was way too short for ms and timezone display
                    textFieldProperties: {
                        width:200,
                        textAlign:isc.Page.isRTL() ? isc.Canvas.RIGHT : isc.Canvas.LEFT,
    validateOnChange:true,
    validators: [{type:"toDateCustom",errorMessage:"ERROR",
                                clientOnly:true,
                                validateOnChange:true,
                            condition:function(item, validator, value, record){
                            return false;
                        }}]
                    },
                    showErrorIcon: true
                },
                toFieldProperties:{
                    width:180,
                                    textFieldProperties: {
                        showErrorIcon: true,    width:200,
                        textAlign:isc.Page.isRTL() ? isc.Canvas.RIGHT : isc.Canvas.LEFT,
                        validateOnChange:true,
    
                            validators: [{type:"toDateCustom",errorMessage:"ERROR",
                                clientOnly:true,
                                validateOnChange:true,
                            condition:function(item, validator, value, record){
                            return false;
                        }}]
                    }
                }
    
            }
        }
    The above code produces a daterange dialog. The validators in the to/from
    Code:
    textFieldProperties
    will be rsponsible for validating the dates and show the user the appropriate error messages.

    The issue here is that alsthough the code is hitting the condition function (which for not just returns false), it is not able to show the error icon. Comparing the above with demo code - I am not able to find any difference in the logic. May be I am missing something that you can point me to.

    Thanks in advance.
    Last edited by shresthg_des; 5th Mar 2015, 09:02.

  • #2
    Instead of assigning properties to the inner textField, just assign them to the fromField and toField directly - literally, just comment out your two outer textFieldProperties blocks, leaving just the attributes they contain.

    That will get things working for the fromField - note, however, that there was a bug in the toField, where custom validators assigned in this way were being clobbered by the internal application of the rangeValidator. That's fixed for builds dated March 8 and later.

    Comment

    Working...
    X