var autocomplete_options = {
    source: '/city-autocomplete',
    dataType: 'json',
    minLength: 1,
    select: function (event, ui) {
        // Cut "_auto" from ID
        document.getElementById(event.target.id.slice(0, -5)).value = ui.item.id;

    },
};

$(document).ready(function () {
    $(".city-autocomplete").autocomplete(autocomplete_options);
});
@@ -256,16 +256,128 @@
  %7D,%0A%7D;%0A%0A
+function add_autocomplete(obj) %7B%0A    obj.find(%22input.city-autocomplete%22).autocomplete(autocomplete_options);%0A%7D%0A%0A
 $(docume
@@ -407,16 +407,21 @@
 %0A    $(%22
+input
 .city-au

Add function to apply autocomplete to dynamically created Step forms, after document.ready