IcreatedthisplugibecauseIwasothappywithayoftheotheroes.Thisplugiwillgiveyousimple,cleaautocompletefuctioalityotheselectedtextbox.
Here'sthecode:
HTMLFile:
<formid="myform"> <iputtype="text"ame="my_textbox"id="my_textbox"/></form><scripttype="text/javascript"><!--$(fuctio() { vardata={ f:'lookup' }; varoptios={ mi_legth:3, error_resposes:[ "Noresults.", "Toomayresults." ] }; $("#suggest").suggest("search.php",data,optios);});--></script>
Exampleserver-sidePHPscript,search.php:
<?php//Prevetcachigheader("Cache-Cotrol:o-cache,must-revalidate"); //HTTP/1.1header("Expires:Ja1,2000"); //Dateithepast$f =$_GET['f'];$allowed_fs=array('lookup');if(!i_array($f,$allowed_fs)) {exit;}pritcall_user_fuc($f);fuctiolookup() { $q=valueIfSet($_GET['q']); $attrs=array("uid","giveame","s"); $filter="level03=95C"; try{ $results=your_ldap_lookup_fuctio($q,$attrs,$filter,true,,1); }catch(Exceptio$e) { retur"Toomayresults."; } if(cout($results)===) { retur"Noresults."; } $list=array(); foreach($resultsas$result) { $s =$result['s']; $g =$result['giveame']; $uid=$result['uid']; $ame="$s,$g($uid)"; array_push($list,$ame); } returimplode("\",$list);}?>
评论