Announcement

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

    Issue on validators??

    I was working with a build of 12-Jan and the following problem was not present, but in 12-March build yes.

    If I define this widget

    Code:
    isc.DynamicForm.create({
        ID: "exampleForm",
        fields: [{
          type: "TextItem",
          blur : function () {
            alert(this.validators[0].type);
          },
          validators : [{
            type : "custom",
            condition : function (form, item, value) {
              return true;
            }
          }],
          required: true
        }]
    });
    no problem. At blur of the widget it appears the alert: "custom"

    but if I define it as

    Code:
    isc.ClassFactory.defineClass("AdvancedTextItem", TextItem);
    
    isc.AdvancedTextItem.addProperties({
      blur : function () {
        alert(this.validators[0].type);
      },
      validators : [{
        type : "custom",
        condition : function (form, item, value) {
          return true;
        }
      }]
    });
    
    isc.DynamicForm.create({
        ID: "exampleForm",
        fields: [{
          type: "AdvancedTextItem",
          required: true
        }]
    });
    At blur of the widget it appears the alert: "required", which is wrong (since both behaviors in both cases should be the same)

    Also this.validators.length is "1" in all cases, so is not that the "required" validation has been added to the array... the "required" validation has override the "custom" validation

    Notice that it only happens when required: true. If required: false the alert is "custom" (which is ok)



    So, the questions:
    1) This is an issue/bug, isn't it?
    2) When it is planed to be solved? (in order to update my version)

    Regards & Thanks.

    #2
    item.required is now a shortcut to adding a "required" validator so you cannot count on yours being the only one. You should find that there are two validators on your item where "required" is typically the last one. In your example there appears to be a problem in the application of the new validator.

    It will be investigated.

    Comment


      #3
      You can try by yourself this code (in 12-March build) and see that what I see is true (in the first case it works, and in the second it doesn't)

      As I have said, with all the possible combinations (first CODE with true or false, or second CODE with true or false) validators.length is always 1, so there isn't two validators in my item...

      Thanks you very much (once more time ;)) and I will be stand by waiting the solution

      Comment


        #4
        This problem has been corrected in will show up in a nightly soon. Note that the order of validators is not guaranteed and I show the required validator before the custom one.

        Comment

        Working...
        X