I have a repeating block with a name text input field. Later on in the form, I would like to use an autocomplete field to prefill the name from the list of repeated element's names if a user begins typing a recognized name, or allow the user to type a custom name. Is this a possibility in Maestro?

    CommentAdd your comment...

    1 answer



      Yes, you can do that with an Autocomplete field configured as Reference Data (Prepop).

      This example is using the default Reference Data Name of data.$myDataField, although you should change that to suit.

      In a Form Load rule, provide a value for the reference data field:

        data.$myDataField = [];

      You can then manipulate the content of the underlying data field at runtime to adjust the list of names to autocomplete on.  Don't provide a new array... adjust the contents of the original array you provided:


          Form.getRepeatData("data.firstName", Form.data)
              .map(function(i) { Form.data.$myDataField.push({label: i}); });

      This would probably be best done in a change rule on your repeated name field.

      1. Will Pierson

        Thanks for the quick response, Bill.

        I am having trouble using this, I have pasted into the change function inside of my first Name block both lines of code you provided, but am still not getting any results, Is the Form.getRepeatData() function supposed to be a third parameter inside of the splice method? Or are these two separate calculations, I am trying to understand how the data to splice will be inserted in the array – let me know if I am on the right track, I cant seem to get this working. 

      2. Unknown User (bfrost)

        Hi Will,

        The splice code is setting the array to empty.  It's the push code inside the map function that adds the new values again.  Both calls depend on data.$myDataField being initialized to an empty array in the Form Load rule.

        The code also assumes your repeat field is called 'First Name', which will generate a data field name of data.firstName.  Are you seeing any errors in the Chrome F12 developer tools console?

      3. Will Pierson

        Got it working! Looks like I was (incorrectly) inserting trigger properties in the autocomplete field. I assumed those were required. Thanks for your help!

      CommentAdd your comment...