Note that there are some explanatory texts on larger screens.

plurals
  1. POAutocomplete like facebook
    primarykey
    data
    text
    <p>I have a question about the development of an AutoComplete, like Facebook in a textarea where the user types the first letters of the name of the friend is shown and a certain list of users that match what he typed.</p> <p>An image to illustrate <a href="http://i.stack.imgur.com/4KXOr.jpg" rel="nofollow">http://i.stack.imgur.com/4KXOr.jpg</a></p> <p>After some research, I found this script: <a href="http://www.hawkee.com/snippet/9391/" rel="nofollow">http://www.hawkee.com/snippet/9391/</a></p> <p>At the end of the JS (line 265 of the URL above), i implemented a code to bring me the friends list:</p> <pre><code>$('#strRecado').triggeredAutocomplete({ hidden: '#hidden_inputbox', &lt;? $vetAmigosRecado = Usuario::getAmigos($_SESSION['sesTuupleCodUsuario']); $count = count($vetAmigosRecado); if($vetAmigosRecado) { echo "source: new Array("; for($i=0; $i&lt;$count; $i++) { echo "{'value':'".$vetAmigosRecado[$i]['codUsuario']."',"; if ($vetAmigosRecado[$i]['fileImagem'] != NULL) echo "'img':'".URL."photo.php?param=usuarios/".$vetAmigosRecado[$i]['codUsuario']."/fotos/".$vetAmigosRecado[$i]['fileImagem'].",50,50,2'"; else echo "'img':'".URL."photo.php?param=img/foto_perfil.jpg,50,50,2'"; echo ",'label':'".$vetAmigosRecado[$i]['nomeCompleto']; if($i==$count-1) echo "'})\n"; else echo "'},\n"; } } ?&gt; </code></pre> <p>It worked perfectly. The return is getting well:</p> <pre><code>$('#strRecado').triggeredAutocomplete({ hidden: '#hidden_inputbox', source: new Array({'value':'USER-CODE','img':'AVATAR-URL','label':'USERNAME'}) }); </code></pre> <p>With everything working as I wanted, came the question: how do I "link", so to speak, the user name and inform the database he was quoted?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload