Announcement

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

    unexpected validate requests in 13.1

    SmartClient Version: SNAPSHOT_v13.1d_2023-10-17/Enterprise Deployment (built 2023-10-17)

    Hello, I just noticed that I've some unexpected validate requests on application load using 13.1 (doesn't happen with latest 13.0)

    The pattern I've found is that on some databound forms, with formItems that have validators in the dataSources (required AND (serverCustom OR isUnique)), there are validate requests on application load (forms defined but not even drawn). If I comment out the serverCustom/isUnique validator, the requests vanish.

    Are you aware of some change which may trigger those requests too early?

    #2
    No, there's nothing that was changed that should be causing this. Things to check:

    1. see if these forms are actually being drawn, then clear()d or perhaps are drawn but are hidden. You can turn on the "draws" and "clears" logs to see this, or just look in the Watch tab

    2. use Log.traceLogMessage() to obtain a stack trace for the validation request. Just use any log message you see related to it, possibly turning on log categories such as RPCManager if there aren't already logs. This should show how the validation request was triggered, which may explain it to you, or if not, you can share the trace with us so we can figure it out.

    Comment


      #3
      Hello, seeing the logs it seems that the forms aren't drawn.

      The stack trace for the validate request is that I can see in the RPC->Call Stack tab, isn't it? Here it is:

      Code:
      cons.sendRequest(request=>Obj) on [Class RPCManager] @ ISC_DataBinding.js:50610:43
      cons.performSCServerOperation(dsRequest=>Obj, data=>Obj) on [DataSource ID:OSS_CALENDARIO_PROVE] @ ISC_DataBinding.js:79457:35
      cons.sendDSRequest(dsRequest=>Obj) on [DataSource ID:OSS_CALENDARIO_PROVE] @ ISC_DataBinding.js:27913:29
      cons.performDSOperation(operationType=>"validate", data=>Obj, callback=>_dsCallback(), requestProperties=>Obj) on [DataSource ID:OSS_CALENDARIO_PROVE] @ ISC_DataBinding.js:27580:21
      cons.validateData(values=>Obj, callback=>_dsCallback(), requestProperties=>Obj) on [DataSource ID:OSS_CALENDARIO_PROVE] @ ISC_DataBinding.js:26153:23
      cons.fireServerValidation(field=>[DateTimeItem ID:undefined name:DATA_PROVA], record=>Obj, validationMode=>"partial", showPrompt=>false, rowNum=>undef, pendingAdd=>true, callerContext=>undef) on [DynamicForm ID:gestCalendarioProveUpdateEventForm] @ ISC_Core.js:127870:8
      cons.validateField(field=>[DateTimeItem ID:undefined name:DATA_PROVA], validators=>Array[4], value=>undef, record=>Obj, options=>Obj) on [DynamicForm ID:gestCalendarioProveUpdateEventForm] @ ISC_Core.js:127741:18
      cons.validateFieldAndDependencies(field=>[DateTimeItem ID:undefined name:DATA_PROVA], validators=>Array[4], newValue=>undef, record=>Obj, options=>Obj) on [DynamicForm ID:gestCalendarioProveUpdateEventForm] @ ISC_Core.js:127474:28
      cons.validate(deferServerValidation=>undef, validationOptionOverrides=>undef) on [DateTimeItem ID:undefined name:DATA_PROVA] @ ISC_Forms.js:36465:32
      cons.checkDateRangeValidator(start=>undef, end=>undef) on [DateTimeItem ID:undefined name:DATA_PROVA] @ ISC_Forms.js:41739:31
      cons.init() on [DateTimeItem ID:undefined name:DATA_PROVA] @ ISC_Forms.js:66330:14
      cons.completeCreation(A=>Obj{name:DATA_PROVA}, B=>undef, C=>undef, D=>undef, E=>undef, F=>undef, G=>undef, H=>undef, I=>undef, J=>undef, K=>undef, L=>undef, M=>undef) on [DateTimeItem ID:undefined name:DATA_PROVA] @ ISC_Core.js:8896:14
      cons.createItem(item=>[DateTimeItem ID:undefined name:DATA_PROVA], type=>"DateTimeItem") on [DynamicForm ID:gestCalendarioProveUpdateEventForm] @ ISC_Forms.js:11473:14
      cons._addItems(newItems=>Array[3], position=>null, fromSetItems=>true, firstInit=>true) on [DynamicForm ID:gestCalendarioProveUpdateEventForm] @ ISC_Forms.js:11244:45
      cons._setItems(itemList=>Array[3], firstInit=>true) on [DynamicForm ID:gestCalendarioProveUpdateEventForm] @ ISC_Forms.js:11015:10
      cons.initWidget() on [DynamicForm ID:gestCalendarioProveUpdateEventForm] @ ISC_Forms.js:10778:10
      cons.init(A=>Obj{ID:gestCalendarioProveUpdateEventForm}, B=>undef, C=>undef, D=>undef, E=>undef, F=>undef, G=>undef, H=>undef, I=>undef, J=>undef, K=>undef, L=>undef, M=>undef) on [DynamicForm ID:gestCalendarioProveUpdateEventForm] @ ISC_Core.js:79626:10
      cons.completeCreation(<no args: recursion>)  on [DynamicForm ID:gestCalendarioProveUpdateEventForm] @ ISC_Core.js:8896:14
      create(A=>Obj{ID:gestCalendarioProveUpdateEventForm}, B=>undef, C=>undef, D=>undef, E=>undef, F=>undef, G=>undef, H=>undef, I=>undef, J=>undef, K=>undef, L=>undef, M=>undef) on [Class DynamicForm] @ ISC_Core.js:5850:39
      null.<anonymous>(<no args: exited>) @ everyRole.js:26405:17
      The line in my code is where there's the isc.DynamicForm.create.

      the DATA_PROVA field is defined as:

      Code:
             <field name="DATA_PROVA" type="datetime" required="true">
                  <validators>
                      <validator type="isUnique" criteriaFields="ID_GIOCATORE_FK,DATA_PROVA,ID_SQUADRA_FK">
                      </validator>
                  </validators>
              </field>

      Comment


        #4
        Hello, I've just discovered that if I change, in the formItem, the type of that DATA_PROVA field to "text", than the validate is not triggered.

        Otherwise, if I re-create a form in the console with this code:

        Code:
        isc.DynamicForm.create({
            dataSource: "OSS_CALENDARIO_PROVE",
            fields: [
                {
                    name: "DATA_PROVA",
                    title: "Data prova",
                    type: "datetime"
                }
            ]
        });
        the validate is triggered after creation.

        Does this help?

        Comment


          #5
          I've also tried in another, simpler application, I've added a isUnique validator on a MODIFIER_TIMESTAMP field:

          Code:
                  <field name="MODIFIER_TIMESTAMP" type="modifierTimestamp">
                      <validators><validator type="isUnique"/></validators>
                  </field>
          then if I execute this code:

          Code:
          isc.DynamicForm.create({
              dataSource: "AUTH_APPS_EXT",
              fields: [
                  {
                      name: "MODIFIER_TIMESTAMP"
                  }
              ]
          });
          I see a validate request:

          Code:
          {
              dataSource:"AUTH_APPS_EXT",
              operationType:"validate",
              data:{
                  MODIFIER_TIMESTAMP:null
              },
              textMatchStyle:"exact",
              willHandleError:true,
              showPrompt:false,
              prompt:"Validazione in corso...",
              oldValues:{
                  MODIFIER_TIMESTAMP:null
              },
              requestId:"AUTH_APPS_EXT_request5",
              internalClientContext:{
                  component:{
                      ns:Obj,
                      dataSource:[DataSource ID:AUTH_APPS_EXT],
                      fields:Array[1],
                      ID:"isc_DynamicForm_0",
                      position:"absolute",
                      className:"form",
                      width:100,
                      height:20,
                      items:Array[1],
                      values:Obj,
                      originalFields:Array[1],
                      errors:Obj
                  },
                  fieldName:"MODIFIER_TIMESTAMP",
                  rowNum:{
                  },
                  pendingFields:{
                      "0":"MODIFIER_TIMESTAMP",
                      Class:"Array",
                      localeStringFormatter:"toString"
                  }
              },
              fallbackToEval:false,
              validationMode:"partial",
              pendingAdd:true,
              bypassCache:true,
              dataProtocol:"getParams"
          }
          and this is the call stack:

          Code:
              cons.sendRequest(request=>Obj) on [Class RPCManager] @ ISC_DataBinding.js:50702:43
              cons.performSCServerOperation(dsRequest=>Obj, data=>Obj) on [DataSource ID:AUTH_APPS_EXT] @ ISC_DataBinding.js:79595:35
              cons.sendDSRequest(dsRequest=>Obj) on [DataSource ID:AUTH_APPS_EXT] @ ISC_DataBinding.js:28005:29
              cons.performDSOperation(operationType=>"validate", data=>Obj, callback=>_dsCallback(), requestProperties=>Obj) on [DataSource ID:AUTH_APPS_EXT] @ ISC_DataBinding.js:27672:21
              cons.validateData(values=>Obj, callback=>_dsCallback(), requestProperties=>Obj) on [DataSource ID:AUTH_APPS_EXT] @ ISC_DataBinding.js:26245:23
              cons.fireServerValidation(field=>[DateTimeItem ID:undefined name:MODIFIER_TIMESTAMP], record=>Obj, validationMode=>"partial", showPrompt=>false, rowNum=>undef, pendingAdd=>true, callerContext=>undef) on [DynamicForm ID:isc_DynamicForm_0] @ ISC_Core.js:127870:8
              cons.validateField(field=>[DateTimeItem ID:undefined name:MODIFIER_TIMESTAMP], validators=>Array[3], value=>undef, record=>Obj, options=>Obj) on [DynamicForm ID:isc_DynamicForm_0] @ ISC_Core.js:127741:18
              cons.validateFieldAndDependencies(field=>[DateTimeItem ID:undefined name:MODIFIER_TIMESTAMP], validators=>Array[3], newValue=>undef, record=>Obj, options=>Obj) on [DynamicForm ID:isc_DynamicForm_0] @ ISC_Core.js:127474:28
              cons.validate(deferServerValidation=>undef, validationOptionOverrides=>undef) on [DateTimeItem ID:undefined name:MODIFIER_TIMESTAMP] @ ISC_Forms.js:36465:32
              cons.checkDateRangeValidator(start=>undef, end=>undef) on [DateTimeItem ID:undefined name:MODIFIER_TIMESTAMP] @ ISC_Forms.js:41739:31
              cons.init() on [DateTimeItem ID:undefined name:MODIFIER_TIMESTAMP] @ ISC_Forms.js:66330:14
              cons.completeCreation(A=>Obj{name:MODIFIER_TIMESTAMP}, B=>undef, C=>undef, D=>undef, E=>undef, F=>undef, G=>undef, H=>undef, I=>undef, J=>undef, K=>undef, L=>undef, M=>undef) on [DateTimeItem ID:undefined name:MODIFIER_TIMESTAMP] @ ISC_Core.js:8896:14
              cons.createItem(item=>[DateTimeItem ID:undefined name:MODIFIER_TIMESTAMP], type=>"DateTimeItem") on [DynamicForm ID:isc_DynamicForm_0] @ ISC_Forms.js:11473:14
              cons._addItems(newItems=>Array[1], position=>null, fromSetItems=>true, firstInit=>true) on [DynamicForm ID:isc_DynamicForm_0] @ ISC_Forms.js:11244:45
              cons._setItems(itemList=>Array[1], firstInit=>true) on [DynamicForm ID:isc_DynamicForm_0] @ ISC_Forms.js:11015:10
              cons.initWidget() on [DynamicForm ID:isc_DynamicForm_0] @ ISC_Forms.js:10778:10
              cons.init(A=>Obj, B=>undef, C=>undef, D=>undef, E=>undef, F=>undef, G=>undef, H=>undef, I=>undef, J=>undef, K=>undef, L=>undef, M=>undef) on [DynamicForm ID:isc_DynamicForm_0] @ ISC_Core.js:79626:10
              cons.completeCreation(<no args: recursion>) on [DynamicForm ID:isc_DynamicForm_0] @ ISC_Core.js:8896:14
              create(A=>Obj, B=>undef, C=>undef, D=>undef, E=>undef, F=>undef, G=>undef, H=>undef, I=>undef, J=>undef, K=>undef, L=>undef, M=>undef) on [Class DynamicForm] @ ISC_Core.js:5850:39
              null.<anonymous>(<no args: exited>) @ [no file]:1:17

          Comment


            #6
            hi Claudio,

            We've fixed the bug that allowed a validation attempt from DateItem/DateTimeItem/RelativeDateItem.init(), before draw(), which should never happen. We didn't see the issue if we just added your modifierTimestamp field to a random DS and bound your DynamicForm sample to it. The invalid calls to validate() only occurred in our testing if the item/field had a startDate or endDate assigned, or some additional validators.

            The change we've made fixes the unexpected pre-draw calls to item.validate(), and you can try it out in today's builds.

            If you still see issues with those builds:

            1) are you reporting that the modifierTimestamp field itself is being validated incorrectly (the type is treated as a date and shows a DateTimeItem, and that's what your stack seems to show), or that some *other* field is being validated because of the modifierTimestamp field? The latter would be unexpected, unless there are explicit dependencies between the fields

            2) could you show a runnable test that shows the issue?

            Comment


              #7
              Hello, I'll wait for the build to test the fix, but I can anticipate you that I've got this setting in my application:
              Code:
              isc.DateItem.addProperties({
                  startDate: isc.Date.createLogicalDate(new Date().getFullYear() - 5, 1, 1, 0, 0, 0),
                  endDate: isc.Date.createLogicalDate(new Date().getFullYear() + 14, 12, 31, 0, 0, 0)
              })
              so I'm pretty confident that the fix will work :)

              Comment


                #8
                SmartClient Version: SNAPSHOT_v13.1d_2023-10-29/Enterprise Deployment (built 2023-10-29)

                Hello, I can confirm it's working, thank you very much

                Comment

                Working...
                X