Jquery UI autocomplete??

Should a custom lightbox section be able to work with Jquery autocomplete?

I have a textfield throughout my app that uses it. I would like the same functionality that users enjoy in the lightbox; however, autocomplete will execute. Any ideas?

Here is an example. Also, everything else works fine in the scheduler, except autocomplete

scheduler.form_blocks["patients"] = {
        render: function (sns) {
            return "<div class='dhx_cal_ltext' style='height:40px;'><label for='ap'>Search: </label><input id='ap'>&nbsp;<a href='#' onclick=Smc.patientClear('ap');>clear</a></div>";
        },
        set_value: function (node, value, ev) {
            node.childNodes[1].value = value || "";
        },
        get_value: function (node, ev) {
            return node.childNodes[1].value;
        },
        focus: function (node) {
            var a = node.childNodes[1]; a.select(); a.focus();
        }
    }
 scheduler.config.lightbox.sections = [ 
            { name: 'patient', map_to: 'patient_name', type: 'patients' }
]
<script type="text/javascript">
$(document).ready(function () {
  $( "#ap" ).autocomplete({ 
       source: ["personA", "personB", "personC"] 
   });
});
</script>

Hello,

Made it work with the following code:

scheduler.attachEvent("onLightbox", function(event_id){ $("#ap").autocomplete( ["personA", "personB", "personC"] ); });

  1. autocomplete expects url or array as parameter (according to documentation).
  2. $("#ap") doesn’t exist from the start. Lightbox form is generated only then it’s opened for the first time (and again if form was reset).
  3. Note that ‘onLightbox’ event is fired everytime lightbox is displayed and depending on autocomplete behavior you may not need to init it again (use some kind of flag in such case).

Best regards,
Ilya

Thanks. Once the code was moved into onLightbox event, it worked.