Today I upgraded my project from Maestro version 5.1.5 to 17.10.2.

I have an autocomplete component for 'Your Name' with a DDS source, with code defined for the 'On List Item Select' event to populate other form fields (Phone number, Address, Position Title etc) also delivered in the DDS response.

In Maestro 5.1.5, you would see the form fields populated instantaneously after selecting an autocomplete list item.  In Maestro 17.10.2, I see nothing until I click elsewhere on the form (likely triggering some OnBlur event).

At first, I thought that the On List Item Select event wasn't firing at the correct time, but after adding some console.log debug messages and interacting with the form in developer mode, I can see that the event is firing and the form fields are having their values set correctly, straight after I select an autocomplete list item.

So the problem appears to be that Maestro 17.10.2 is treating events differently, deferring refreshing values in other components until some kind of onblur event.

How can I trigger this refresh / recalculation in code, after I've set my form values?

    CommentAdd your comment...

    1 answer


      Hi Andrew,

      I'm not seeing that behavior on 17.10.2.

      Are there any errors reported in the console?

      Can you export a cut-down form/service that reproduces the problem?


      1. Andrew Halliday

        Hi Bill,

        Thanks for such a prompt reply.

        There are no errors in the console and I've already constructed a purpose built form to tease out this issue.  But its tightly integrated, so may be hard to hand to you.

        However, knowing that this is working for you in 17.10.2 focused my attention on the additional code I've got running in the form - as that it's now the most likely culprit.

        I'm using my DDS interceptor code from the KB article Refresh autocomplete suggestions from a self-updating data field for the autocomplete, but I think the code I've got in the 'On List Item Select' event handler is most likely the problem.

        The code that I've got in the event handler is asynchronous, which may be the issue:

        var xhttp = new XMLHttpRequest();
            xhttp.open("GET", "https://localhost:44398/GetUserByName/json/" + data.firstName, true);
            xhttp.onreadystatechange = function(){
              if (xhttp.readyState === XMLHttpRequest.DONE) {
                if (xhttp.status === 200) {
                  try { personData = JSON.parse(xhttp.responseText); }
                  catch (e) {console.log('Received an invalid JSON response of: ' + xhttp.responseText);}
                  data.textField_1 = "You selected: " + personData.givenname;
                  console.log('Set data.textField_1 to "' + data.textField_1 + '"');
                  console.log('There was a problem with the GetUserByName request.');

        Was there some change after Maestro 5.1.5 to eliminate extraneous form value re-calculations? It seems I'm getting less console debug messages coming from my Data Fields.  If so, this may explain why this worked in 5.1.5 but not 17.10.2 ... I was relying on one of these 'extraneous re-calculations'.

        After adding this line to the top of the event handler:

        data.textField_1 = "asynchronicity is likely your problem";

        The value appeared instantaneously in the text field after a list item was selected.

        Is there a way to invoke a re-calculation / refresh after I've set the form values?

      2. Unknown User (bfrost)

        Hi Andrew,

        I'm hoping your form is only for some kind of experimentation, because it doesn't fit the normal communication model of a Maestro form.

        Having said that, and with the understanding that I haven't been able to test this, you could try using this code to trigger an angular change detection loop:



      3. Andrew Halliday

        Hi Bill,

        Yeah, conceded.  I realize that my approach is outside the usual communication model of a Maestro form, the rationale for this and restrictions of the Autocomplete field are documented in the KB article linked in my comment above.  It was the only way I could meet our requirements.

        Thankfully, your suggestion here did do the trick and I'm now getting an instant visual update of the field, even though its value is updated asynchronously:



      CommentAdd your comment...