<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[jquery autocomplete e popolamento campo testo]]></title><description><![CDATA[<p dir="auto">Buongiorno a tutti, sono poco esperto di jquery e js.<br />
Ho cercato ma non riesco a venire a capo di un problema.</p>
<p dir="auto">DB Mysql - tabella con 3 campi:<br />
| id_for | cod_for | des_for |</p>
<p dir="auto">1 - creo un file json per un campo form autocomplete. Funziona.<br />
2 - seleziono il nome desiderato dopo ricerca con minimo 2 caratteri. Funziona.<br />
3 - popolo due campi testo con cod_for (F00093) e des_for (ABELLI ANTONIO). Funziona.<br />
4 - nello stesso momento in un terzo campo testo compongo il nome file che andrà caricato, secondo lo schema:<br />
aaaa_mm_id(autoincrease)_fornitore(cod_for).pdf - (2015_10_00011_F00093.pdf)</p>
<p dir="auto">Nel campo autocomplete con <em>onChange="componi()"</em> richiamo la funzione per creare il nome file,</p>
<p dir="auto">QUI ERRORE: il nome composto risulta: 2015_10_00011_<strong>ab</strong>.pdf (dove <strong>ab</strong> sono le due lettere digitate per selezionare il nome fornitore sul campo autocomplete, suppongo che il tag <em>onChang</em>e non va, provo <em>onSelect, on keyUp</em>... ma nulla!<br />
Non riesco a capire.. sono bloccato... Mi potete aiutare? Grazie in anticipo.</p>
<pre><code class="language-html">&lt;script&gt;
jQuery(document).ready(function(){
    //"keyup" event handler to reset input fields  &amp;&amp; '#project-cod_for'
    $( "#project" ).live('keyup', function(e){
        //Improved with keycode checking to prevent extra typing after select
        var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
        var keyCode = $.ui.keyCode;
        if(key != keyCode.ENTER &amp;&amp; key != keyCode.LEFT &amp;&amp; key != keyCode.RIGHT &amp;&amp; key != keyCode.DOWN) {
            $('#project-des_for').val("");
        }
    });

    $( "#project" ).combogrid({
        debug:true,
        colModel: [{'columnName':'name','label':'Fornitore'}],
        url: 'server.php',
        //"select item" event handler to set input fields
        select: function( event, ui ) {
            $( "#project" ).val( ui.item.name );
            $( "#project-des_for" ).val( ui.item.name );
            $( "#project-cod_for" ).val( ui.item.author );
            
            return false;
        }
    });
});
&lt;/script&gt;
&lt;script type="text/javascript"&gt;
            function componi()
            {
                var myTesto=document.getElementById("name");
                var mycodice=document.getElementById("project");
                var valorecodice=mycodice.value;
                var myidp=document.getElementById("idp");
                var valoreidp=myidp.value;
                var today=new Date();
                year=today.getYear();
           
               if(year&lt;1900)year=year+1900;
               if(valorecodice!=""&amp;valoreidp!="")
                {
                //myTesto.value=year+"_"+(today.getMonth()+1)+"_"+valoreidp+"_"+valorecodice;
                myTesto.value=year+"_"+('0' + (today.getMonth() + 1)).slice(-2)+"_"+valoreidp+"_"+valorecodice;
                }           
            }
        &lt;/script&gt;
&lt;form bla bla&gt;
&lt;input size="16" type="text" name="cod_for" id="project-cod_for" class="stile1" readonly="readonly"/&gt; (campo testo con codice fornitore F00093)
&lt;input size="50" name="des_for" id="project-des_for" class="stile1" readonly="readonly"/&gt; (campo testo con descrizione fornitore ABELLI ANTONIO)
&lt;input  type="text" name="data_fatt" size="10" id="data_fatt" /&gt;
&lt;input name="num_fatt" type="text" class="stile1" id="num3" onfocus="document.getElementById('num').style.backgroundColor='#fff';  this.value=' '; return false;" size="15" /&gt; (campo testo numero progressivo id autoincrement)
&lt;input type="text" id="name" name="name" size="50" class="stile1" readonly="readonly" /&gt; (campo testo nome file pdf composto 2015_10_00011_ab.pdf)
&lt;input type="submit" name="Submit" value="Inserisci" class="pulsante" /&gt;
&lt;/form&gt;
</code></pre>
<p dir="auto">Spero di essere stato esaustivo, grazie ancora</p>
]]></description><link>https://dev.connect.gt/topic/218229/jquery-autocomplete-e-popolamento-campo-testo</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 10:53:00 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/218229.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 16 Oct 2015 10:55:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to jquery autocomplete e popolamento campo testo on Wed, 21 Oct 2015 20:53:48 GMT]]></title><description><![CDATA[<p dir="auto">Ho risolto, da quel che ho capito la chiamata alla funzione <strong>componi()</strong> la inserisco direttamente nel metodo select:</p>
<pre><code>select:function( event, ui ){
            $("#project").val( ui.item.name );
            $("#project-des_for").val( ui.item.name );
            $("#project-cod_for").val( ui.item.author );
[COLOR=#b22222][B]               componi();[/B][/COLOR]
            return false;
        }
</code></pre>
<p dir="auto">è sbagliata anche questa istruzione:</p>
<pre><code>var mycodice=document.getElementById("project");
</code></pre>
<p dir="auto">è invece:</p>
<pre><code>var mycodice=document.getElementById("project-cod_for");
</code></pre>
<p dir="auto">Grazie a tutti.</p>
]]></description><link>https://dev.connect.gt/post/1209551</link><guid isPermaLink="true">https://dev.connect.gt/post/1209551</guid><dc:creator><![CDATA[linno]]></dc:creator><pubDate>Wed, 21 Oct 2015 20:53:48 GMT</pubDate></item><item><title><![CDATA[Reply to jquery autocomplete e popolamento campo testo on Wed, 21 Oct 2015 10:28:36 GMT]]></title><description><![CDATA[<p dir="auto">Buongiorno a tutti,<br />
nessun suggerimento?<br />
Grazie.</p>
]]></description><link>https://dev.connect.gt/post/1209550</link><guid isPermaLink="true">https://dev.connect.gt/post/1209550</guid><dc:creator><![CDATA[linno]]></dc:creator><pubDate>Wed, 21 Oct 2015 10:28:36 GMT</pubDate></item><item><title><![CDATA[Reply to jquery autocomplete e popolamento campo testo on Sun, 18 Oct 2015 08:30:52 GMT]]></title><description><![CDATA[<p dir="auto">Buongiorno!<br />
grazie, sì, il problema è questo. Passa il valore digitato (una, due o tre lettere) e non il valore (codice fornitore) legato al fornitore selezionato. allego un print.<br />
Spero di riuscire a capire insieme a voi....</p>
<p dir="auto"><a href="http://ettoreinnocente.org/prt_scr_1.jpg" rel="nofollow ugc">ettoreinnocente.org/prt_scr_1.jpg</a></p>
]]></description><link>https://dev.connect.gt/post/1209549</link><guid isPermaLink="true">https://dev.connect.gt/post/1209549</guid><dc:creator><![CDATA[linno]]></dc:creator><pubDate>Sun, 18 Oct 2015 08:30:52 GMT</pubDate></item><item><title><![CDATA[Reply to jquery autocomplete e popolamento campo testo on Sun, 18 Oct 2015 01:17:25 GMT]]></title><description><![CDATA[<p dir="auto">Ciao linno,</p>
<p dir="auto">in pratica vorresti che il terzo campo di testo fosse popolato col nome del file, ed il tuo problema è che anzichè inserire il codice del fornitore ti inserisce le lettere ( non autocompletate ) del campo descrizione fornitore?</p>
]]></description><link>https://dev.connect.gt/post/1209552</link><guid isPermaLink="true">https://dev.connect.gt/post/1209552</guid><dc:creator><![CDATA[miwebdesign]]></dc:creator><pubDate>Sun, 18 Oct 2015 01:17:25 GMT</pubDate></item></channel></rss>