Announcement

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

    field validation in Chrome

    SC_SNAPSHOT-2010-12-15/PowerEdition Development Only (built 2010-12-15)

    Our field validations do not show when being viewed in Chrome. Works fine in IE and Firefox. I get the following warning when I try to call page$content$$content$doc_int_DTRulesGrid.validate() in the debugger:

    Code:
    10:24:00.520:TMR7:WARN:Validator:validator not understood on item: TextItem{eventParent: [DynamicForm ID:page$content$$content$doc_int_DTRulesGrid],
    containerWidget: [DynamicForm ID:page$content$$content$doc_int_DTRulesGrid],
    form: [DynamicForm ID:page$content$$content$doc_int_DTRulesGrid],
    title: "<nobr>Error Code - Rule Error Val = 21&n..."[51],
    width: "*",
    ID: "page$content$$content$E_Code",
    name: "page$content$$content$E_Code",
    errorIconSrc: "/cwf/r/cwfv/error.png",
    type: "cwinteger",
    cwIsVisible: true,
    cwParentValidationListener: "none",
    cwDisabled: false,
    disabled: false,
    showDown: false,
    showFocused: false,
    cwIsFromBlur: true,
    hasFocus: false,
    cwCallTriggerEnabled: 0,
    validators: Array[1],
    cwValidationStatus: 0,
    cwFreshValidation: true}:
    {
        "0":{
            "type":"custom", 
            "condition":"false", 
            "errorMessage":"AE0002: Doc - Int - Data Type Level  - Validation Rules"
        }
    }

    #2
    It looks like you are in fact feeding malformed validation definitions to the widget in Chrome - see the log - it looks almost as though you meant to pass an Array of Object and passed an Object instead where slot zero had a nested object.

    You mentioned at one point you were using GWT but not SmartGWT.. there's a bug in GWT in Chrome in Dev Mode only that would cause something like this.

    Comment


      #3
      Indeed we are using GWT compiled code, not SmartGWT - though I do get the problem irrelevant of whether I am running in development mode or not. Here's our code snippet. Should I be doing validators = new Array()?

      Code:
      var validators = [];
          var errorMessages = [];
            var parent = scJsObject.form==null?scJsObject.parentElement:scJsObject.form;
          if (messages != null) {
            var i = 0;
            var p1 = 0;
            do {
              var message;
              var p2 = messages.indexOf("\n");
              var message = messages.substring(p1, p2 < 0 ? messages.length : p2);
              message.replace("\\n", "\n");
               validators[i] = { type:"custom", condition:"false", errorMessage:message };
              if (p2 >= 0) {
                messages = messages.substring(p2 + 1);
              }
              errorMessages[errorMessages.length] = message;
              i++;
            } while (p2 >= 0);
      	    scJsObject.setProperty("errorIconSrc", icon);
      	    
            scJsObject.setProperty("validators", validators);

      Comment


        #4
        This part of your code looks fine (new Array() should not be needed). However, at some point, the data you provide is getting changed to an Object. Try to isolate that - it may have something to do with going in and out of JSNI in GWT, or crossing a frame boundary.

        Comment


          #5
          Ok. I printed it is the isc log and it comes up with this value:

          [object Object]

          Comment


            #6
            I see what you are saying now. I'll look into it further

            Evaluator: result of 'page$validateContinueNavBar$currentObject$$content$lastName.validators' (0ms):
            {0: Obj{type:custom}}
            Evaluator: result of 'typeof(page$validateContinueNavBar$currentObject$$content$lastName.validators)' (0ms):
            "object"

            Comment


              #7
              I tried the same testcase and evaluation in firefox and I get the exact same results. I also tried the evaluation below in both Chrome and Firefox - not sure where else to check for this

              'page$validateContinueNavBar$currentObject$$content$lastName.validators.constructor':
              Array()
              Last edited by acarur01; 22 Dec 2010, 11:57.

              Comment


                #8
                The piece of code that I left out was causing the problem! I call setFieldErrors and pass in errorMessages which is an Array of strings. If I change it to just a test "errorMessage" string, it works! You mentioned this is a Chrome specific bug?

                Code:
                parent.setFieldErrors(scJsObject.name, errorMessages, true);

                Comment


                  #9
                  There's a core GWT bug specific to Chrome Dev mode.

                  There aren't any known bugs in these APIs related to your usage (regardless of browser). Have you isolated something that looks like a bug?

                  Comment

                  Working...
                  X