Announcement

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

    ListGrid : Editing a row : Problem with Validate Request being sent twice when tabbing off a type=date field

    v11.1p_2019-08-17/LGPL, Chrome v97.0.4692.99, using the Enterprise skin

    We've noticed a problem with the sending of Validate requests to the server when editing type=date fields present in a ListGrid edit row. Editing the date field, changing it's value, and then tabbing off to the next field causes two validate requests to be sent to the server, not one as you'd expect. Other field type's only send one validate request to the server. This behaviour was only noticed when implementing some new functionality into our software. Here is a standalone test case that demonstrates the problem :

    Code:
    <html>
    <head>
      <script type="text/javascript">var isomorphicDir = "/js/libs/smartclient/";</script>
      <link rel='stylesheet' type='text/css' href="/js/libs/smartclient/skins/Enterprise/skin_styles.css" />
      <script type="text/javascript" src="/js/libs/smartclient/system/modules-debug/isc_core.js"></script>
      <script type="text/javascript" src="/js/libs/smartclient/system/modules-debug/isc_foundation.js"></script>
      <script type="text/javascript" src="/js/libs/smartclient/system/modules-debug/isc_containers.js"></script>
      <script type="text/javascript" src="/js/libs/smartclient/system/modules-debug/isc_grids.js"></script>
      <script type="text/javascript" src="/js/libs/smartclient/system/modules-debug/isc_forms.js"></script>
      <script type="text/javascript" src="/js/libs/smartclient/system/modules-debug/isc_databinding.js"></script>
      <script type="text/javascript" src="/js/libs/smartclient/system/modules-debug/isc_richtexteditor.js"></script>
      <script type="text/javascript" src="/js/libs/smartclient/system/modules-debug/isc_drawing.js"></script>
      <script type="text/javascript" src="/js/libs/smartclient/skins/Enterprise/load_skin.js"></script>
    </head>
    <body>
      <script>
        var ds = isc.RestDataSource.create({
          dataFormat: 'json',
          jsonPrefix: "",
          jsonSuffix: "",
          operationBindings: [
            { operationType: "fetch", dataURL: "BugFetch.js" },
            { operationType: "validate", dataURL: "BugValidate.js" }
          ],
          fields: [
            { name: "ID", title: "ID", type: "integer", width: 120, canEdit: true, validators: [{ serverOnly: true }] },
            { name: "DATE", title: "Date", type: "date", width: 150, canEdit: true, validators: [{ serverOnly: true }] },
            { name: "NAME", title: "Name", type: "text", width: 400, canEdit: true, validators: [{ serverOnly: true }] }
          ],
          transformRequest: function (dsRequest) {
            var data = this.Super("transformRequest", arguments);
    
            if (dsRequest.operationType == "validate") {
              var component = dsRequest.internalClientContext.component;
              var field = component.getField(dsRequest.internalClientContext.fieldName);
              console.log("validate " + field.name);
            }
    
            return data;
          }
        });
    
        isc.VLayout.create({
          members: [
            isc.ListGrid.create({
              ID: "grid",
              dataSource: ds,
              primaryKey: "ID",
              width: 700,
              height: 400,
              autoFetchData: true,
              canEdit: true,
              validateByCell: true
            })
          ]
        });
      </script>
    </body>
    </html>
    The files BugFetch.js and BugValidate.js contain mocked up server resonses for the fetch and validate operations, which I've attached.

    To see the problem edit the Date field in the row showing and manually change it's value. Then tab off into the Name field. In the Dev Tools console you'll see that 2 validate requests for the DATE field have been logged. Is this something that could be rectified so that only one validate request is sent after manually changing the Date as for other field type's ?

    If someone could find the time to take a look at this issue please and advise it would be appreciated.

    Thanks,
    David.
    Attached Files

    #2
    Hi David, thanks for taking the time to put together a test case, but has this been validated against the latest patched version (see SmartClient.com/builds)? That’s always the first step, otherwise you could be chasing already-fixed bugs.

    Also, if this is new development (sounds like it is), you should be using a more recent version, and should try your test case there.

    Comment


      #3
      Hi,

      Thanks for the response. Apologies for the delay but I've now tried my test case against the latest build of 11.1 LGPL dated 2021-12-11.

      Setup a separate website containing just the runtime files, the Enterprise skin and my test case files. Unfortunately I'm still seeing the same problem. On editing the Date field and tabbing off I'm still seeing two validate requests being sent to the server. The Dev Tools console shows "validate DATE" twice.

      Would it be possible for someone to look into this further please and advise.

      Thanks,
      David.

      Comment

      Working...
      X