Announcement

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

    Problem with Server Validation not being fired on occasion for a DynamicForm with autofocus:true

    v11.1p_2019-05-15/LGPL, Chrome v76.0.3809.100, using the Enterprise skin.

    A little while back upgraded to the above version to resolve a different problem but are now noticing that server validation doesn't fire (always) for a DynamicForm with autofocus:true. Have created a standalone test case to demonstrate the errant behaviour.

    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 type="text/javascript">
        var ds = isc.DataSource.create({
            dataFormat: 'json',
            operationBindings: [
                {operationType: "fetch", dataURL: "BugFetch.js" },
                {operationType: "validate", dataURL: "BugValidate.js" }
            ]
        });
    
        isc.VLayout.create({
            overflow: "auto",
            defaultWidth: "100%",
            defaultHeight: "100%",
            members: [
                isc.DynamicForm.create({
                    autoFocus: true,
                    autoFetchData: true,
                    dataSource: ds,
                    fields: [
                        {   name: "to",
                            validateOnExit: true,
                            height: 20,
                            validators: [{"serverOnly": true }],
                            value: ""
                        },
                        {   type: "button",
                            name: "button0",
                            validateOnExit: true,
                            height: 20,
                            validators: [{"serverOnly": 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 we're observing, first open up the Chrome Dev Tools network trace window and then run the above test case. The cursor shows in the text field. Click the button, then click into the text field, type "aa" (or anything really) and tab out of the field. If you look at the network trace the fetch has been executed but not the field validate for when you tab off the text field.

    Then remove the autofocus:true setting from the DynamicForm. Open network trace, run the test case, but this time the text field hasn't got initial focus, so just click the button, click into the text field, type "aa" and tab off. If you look at the network trace the fetch has been executed but this time the field validate has been executed also as you'd expect.

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

    Thanks,
    David.
    Attached Files

    #2
    Thanks for the test case, however, we are not seeing the results you note. First, there is no regular fetch being made and second, the validate request is occurring in both test cases on tabbing from the the text field. Could you test on a clean install of the SDK package so you know the libraries are correct? The sample code uses non-standard paths and filenames.

    Be sure to perform your tests on the latest nightly build where possible as well.

    Comment


      #3
      Hi,

      Thanks for the reply and taking a look. I've tried the suggestion by setting up a seperate website containing just the SDK runtime files from the nightly build dated 2019-08-10 and my test page and .js files. I'm seeing no difference though I'm afraid and still get the problem. However, the fact you say you can't see the call to BugFetch.js makes me wonder whether you're opening Dev Tools after running the test page? The problem doesn't happen if you open Dev Tools after running the test page. So either, open Chrome, open Dev Tools then run the test page or, with Dev Tools already open, refresh the test page from the chrome toolbar and then try.

      However, done a bit more investigation and it seems to be a field focussing related problem. I've added a focus handler to both the text and button fields in my test page that just writes a message to the Console when the focus handler is fired.

      Code:
         
      var ds = isc.DataSource.create({
              dataFormat: 'json',
              operationBindings: [
                  {operationType: "fetch", dataURL: "BugFetch.js" },
                  {operationType: "validate", dataURL: "BugValidate.js" }
              ]
          });
      
          isc.VLayout.create({
              overflow: "auto",
              defaultWidth: "100%",
              defaultHeight: "100%",
              members: [
                  isc.DynamicForm.create({
                      autoFocus: true,
                      autoFetchData: true,
                      dataSource: ds,
                      fields: [
                          {   name: "to",
                              validateOnExit: true,
                              height: 20,
                              validators: [{"serverOnly": true }],
                              value: "",
                              focus: function (form, item) {
                                  isc.Log.logWarn("**********FOCUS************" + item);
                              }
                          },
                          {   type: "button",
                              name: "button0",
                              validateOnExit: true,
                              height: 20,
                              validators: [{"serverOnly": true }],
                              focus: function (form, item) {
                                  isc.Log.logWarn("**********FOCUS************" + item);
                              }
                          }]
                  })
              ]
          });
      When testing with autoFocus:true present the text field focus handler isn't being fired when you click back into the text field. Without autofocus:true present then the text field focus handler is fired when clicking into the text field. So, just to recap the steps :

      autofocus: true

      Open Chrome, open Dev Tools (or refresh page with Dev Tools already open), focus showing in text field, click the button, click into the text field, type 'aa' and then tab out.

      autofocus: true not present

      Open Chrome, open Dev Tools (or refresh page with Dev Tools already open), click the button, click into the text field, type 'aa' and then tab out

      Thanks,
      David.

      Comment


        #4
        Thanks, David. We are now reproducing the issue. We will update the post when a fix is ready.

        Comment


          #5
          Great, Thank you.

          Comment


            #6
            A fix has been applied for versions 11.1+ and will be available in builds starting with Aug 15.

            Comment


              #7
              Apologies for the delay in replying to your post. Have now tried the nightly build dated 15th Aug and am pleased to confirm that it has sorted the problem with the server validation not firing.

              Thank you,
              David.

              Comment

              Working...
              X