Announcement

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

    Validator Queries

    Hi Isomorphic,

    We are using Smart Client Validation's. We are using version 6.5.1

    We Have few queries :-

    a)How to use addValidator (type, condition) to reuse defined validator's.
    Please provide a working example , as i try to use i am getting "missing formal parameter".

    b) We have a requirement to give error messages as a hover on the fields instead of showing them above the problamatic field's , as it disturbs the layout. So Please Suggest how can we achieve this.

    Thanks For your support.

    #2
    1) An example of using 'addValidator':
    Code:
    isc.Validator.addValidator(
        "notSix", 
        function (item,validator,value) {
            if (value == 6) return false; 
            return true;
        }
    );
    isc.DynamicForm.create({
        ID:"theForm",
        fields: [
            { name: "shoeSize", title: "Shoe Size", editorType: "spinner", defaultValue: 8.5,
              min: 5, max: 13, step: 0.5, width: 70, 
              validators:[{type:"notSix", errorMessage:"Six explicitly disallowed"}]},
            { type:"button", title:"Validate", click:"theForm.validate()"}
        ]
    });
    2) You can suppress the inline error text by setting showErrorText to false. You may also want to change the errorOrientation to "left" so the error icon appears to the left of the form item element rather than above it.
    For 7.0 we're actually changing the default settings so that errors show up this way
    Feel free to explore the DynamicForm reference documentation for additional properties you can set to customize error presentation.

    Comment


      #3
      Thanks

      Thanks Isomorphic :)

      Both of my requirement's are met.

      You Saved my day :)

      Thanks once again.

      Comment


        #4
        Version 7.0 RC - DynamicForm errors

        Hi,

        I've just migrated from 7.0 Beta to 7.0 RC and have encountered some issues
        with how validation messages are being rendered. Before 7.0 RC, I didn't
        need to specify anything for messages to render on top of each field, but with 7.0 RC,
        I now need to have in the following lines:

        Code:
        form.errorOrientation = 'top';
        form.showErrorText = true;
        That's fine. I have no problem with the fact that default rendering behavior changed, but even
        with those settings, the rendering isn't like it used to be before v7.0 RC.

        See the attached screen shots:

        1) v7-Beta-default.png : This is what we had before and what we're expecting.

        2) v7-RC-default.png : This is what we had when not specifying errorOrientation = 'top'.

        3) v7-RC-top.png : This is what we're having when specifying rrorOrientation = 'top'.

        Is there anything else that needs to be specified in order to restore the
        old behavior we had prior to v7.0 RC ?

        Thanking you in advance for your help,
        Attached Files

        Comment


          #5
          Hi yavery,

          To return to 6.5.1's behavior, set showInlineErrors:true and errorOrientation:"top". This will be covered in a release note for final release.

          In a quick test of adding these settings to Layout -> Form Layout -> Titles we can't reproduce the behavior you're showing for errorOrientation:"top". Can you show the rest of the code involved?

          Comment


            #6
            Hi,

            I think I actually figured out why this is happening. I didn't find (yet) a way to cleanly overcome though ...

            My form is configured as follows:

            Code:
            form.errorOrientation = 'top';
            form.showErrorText = true;
            form.showErrorIcons = false;
            But the ISC framework code assumes that when one of these boolean values is false it injects
            an INLINE display style on that DIV even if orientation is set to top.

            Extract from getErrorHTML() @ FormItem.js (line 3,836)
            Code:
            ...
                        writeTable = this.shouldShowErrorIcon() && this.shouldShowErrorText(),
            
            ...            
                        if (!writeTable) {
                			output = isc.SB.concat("<DIV style='display:inline;' CLASS='" 
                                    , this.getCellStyle() , "'>" 
                                    , (this.shouldShowErrorIcon() ? this.getErrorIconHTML(error) + "&nbsp;" : null)
                                    , titleText
            			, messageString
            			, "</DIV>"
            			);
            ...
            Any suggestion on how I can get back to the previous layout when
            text is desired but not icons?

            Thanks again,

            Comment


              #7
              Without getting into the HTML yet, in 7.0 RC, setting showErrorIcons:false still renders fine (doesn't match the bad rendering you provided). Can you try this in the Feature Explorer and confirm?

              Comment


                #8
                Indeed. It does seem to work with a basic simple DynamicForm ... It must be something specific
                to our environment/framework. Let me try to put together a reduced scenario from which
                this can be reproduced. I bet I'll figure out what I'm doing wrong just by trying to put that together ;-)

                In any case, I'll keep you updated.

                Regards,

                Comment


                  #9
                  Hi,

                  I've managed to put together a stripped down version which exposes the problem reported earlier.

                  Code:
                  //----------------
                  DataSource.create
                  ({
                  	ID : 'myTableDS',
                  	fields :
                  	[
                  		{ name : 'LastName', title : 'Last Name',
                  			type : 'text', length : 80, required : true },
                  		{ name : 'FirstName', title : 'First Name',
                  			type : 'text', length : 80, required : true }
                  	]
                  });
                  
                  //----------------
                  isc.defineClass('TestValidation', 'VLayout');
                  TestValidation.addProperties
                  ({
                  	width : '100%',
                  	height : '100%',
                  	autoDraw : true,
                  	initWidget : function()
                  	{
                  		this.Super('initWidget', arguments);
                  
                  		ValuesManager.create
                  		({
                  			ID : 'myVM',
                  			dataSource : myTableDS
                  		});
                  
                  		this.addMember(isc.DynamicForm.create
                  			({
                  				valuesManager : myVM,
                  				dataSource : myVM.dataSource,
                  				numCols : 2,
                  				useAllDataSourceFields : true,
                  				titleOrientation : 'left',
                  				errorOrientation : 'top',
                  				showErrorIcons : false,
                  				showErrorText :  true
                  			}));
                  
                  		this.addMember(isc.Button.create
                  			({
                  				title: 'Validate',
                  				click: 'myVM.validate()'
                  			}));
                  	}
                  });
                  With the code above, the validation messages get rendered to the left of the fields (even if top is specified).

                  Changing the showErrorIcons to true makes the rendering happen on top of the field (desired behavior) but
                  it also renders the icon (of course) but this is not what we want.

                  Any idea why this is happening? I believe it didn't with 7.0 Beta ...

                  PS: This was reproduced on Firefox 3.0.6 / Mac OS 10.5.6.

                  Kind regards,
                  Last edited by yavery; 12 May 2009, 19:55.

                  Comment


                    #10
                    Thanks, with that code we can now see the problem. Looking into it..

                    Comment


                      #11
                      Hi Yan
                      Just a note that we're looking into this and are hoping to get a fix in for 7.0 final, but if you want a workaround for 7.0RC you could add this:

                      Code:
                      isc.FormItem.addProperties({errorIconSrc:"", errorIconWidth:1});
                      That basically ensures that no error icon shows up even with showErrorIcons set to true - obviously it's a temporary hack but will give you the appearance you need until we get this issue resolved in a public build.

                      Thanks
                      Isomorphic Software

                      Comment


                        #12
                        This has now been fixed in our internal codebase and will be resolved in 7.0 final

                        Comment


                          #13
                          Thanks,

                          We'll eagerly wait for the next RC or final version of 7.0.

                          Thanks again for looking into this. Kind regards,

                          Comment

                          Working...
                          X