ALWAYS UNDER DEVELOPMENT
ArcWeb / by Danny

ZendX Jquery Autocomplete using ID of the record

Autocomplete works with labels, and in order to retrive the id of the selected label i added a
hidden field into the form and used select event to set the id in that field.

   $autocomplete =  new ZendX_JQuery_Form_Element_AutoComplete('autocomplete');
   $autocomplete->setLabel( 'autoLabel' )
                ->setJQueryParam("source", 'http://host/controller/autocomplete')
                ->setJQueryParams(array("select" => new Zend_Json_Expr(
                                  'function(event,ui) { $("#autoid").val(ui.item.id) }')
                                       ));

   echo $autocomplete;

The source url should return a json encoded array formed from elements that have ‘value’ and ‘id’ properties.

1 Comment
  1. Thanks very much !!!
    was just what I was looking for !

Leave a Reply

The elephant looks down at you.

CuteCaptcha