salve
uso questo script per l'autocompletamento di un campo
deve leggere più di 3000 elementi, però ci sarà qualche nome nel campo descrizione che avrà qualche carattere particolare, tipo apici, lettere accentate e altro che bloccano l'esecuzione, come posso fare?codice:<script> jQuery.noConflict(); jQuery(function() { jQuery.widget( "app.autocomplete",jQuery.ui.autocomplete, { // Which class get's applied to matched text in the menu items. options: { highlightClass: "ui-state-highlight" }, _renderItem: function( ul, item ) { // Replace the matched text with a custom span. This // span uses the class found in the "highlightClass" option. var re = new RegExp( "(" + this.term + ")", "gi" ), cls = this.options.highlightClass, template = "<span class='" + cls + "'>$1</span>", label = item.value.replace( re, template ), $li = jQuery( "<li/>" ).appendTo( ul ); // Create and return the custom menu item content. jQuery( "<a/>" ).attr( "href", "#" ) .html( label ) .appendTo( $li ); return $li; } }); var availableTags = [ <% Set objConn=Server.CreateObject("ADODB.Connection") objConn.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=10.10.10.10;DATABASE=log;UID=IO;PASSWORD=IO" Set objRs1 = Server.CreateObject("ADODB.Recordset") strSQL1="SELECT DISTINCT Descrizione FROM Clienti WHERE Tipo = 'F'" objRs1.CursorType = 3 objRs1.CursorLocation = 3 objRs1.LockType = 3 objRs1.Open strSQL1, objConn While objRs1.EOF = False if objrs1("Descrizione") <>"" then Descrizione=Descrizione&""""&objrs1("Descrizione")&"""," objRs1.Movenext Wend objRs1.close set objRs1 = Nothing response.Write(left(Descrizione,len(Descrizione)-1)) %> ]; jQuery( "#tags" ).autocomplete({ minLength: 1, highlightClass: "bold-text", source: availableTags }); }); </script>
Grazie

Rispondi quotando