hi Lars, for example if i want pulling data from a database, you said
that something like this:
> or when pulling data from a database using something like WHERE field
> LIKE '$searchterm'
$searchterm is what i type un the input??
and i need to get this value, like this $searchterm=$_REQUEST['id'];??
and in my function ajax.autocompleter, it doesnt change?
<script type="text/javascript">
new Ajax.Autocompleter("autocomplete",
"autocomplete_choices",
"li.php", {
paramName: "value",
minChars: 2,
indicator: 'indicator1'
})
</script>
and finally if in my function with ajax, if I put minChars: 2,
automatically when i type 2 characteres, the query on the database
will run and return the result?
thanks in advance
On 29 ene, 10:11, Lars Schwarz <[email protected]> wrote:
> you need to filter your result list (which was static in your last
> post) of course...
>
> something like:
>
> function autocomplete($needle,$haystack) {
> $html = '<ul class="autocomplete" id="list">';
> foreach($haystack as $straw) {
> if($needle != '' && stristr($straw, $needle)) {
> $html .= '<li class="autocomplete">'.$straw.'</li>';
> }
> }
> $html .= '</ul>';
> echo $html;
>
> }
>
> or when pulling data from a database using something like WHERE field
> LIKE '$searchterm'
>
> hth: lars
>
>
>
>
>
> On Thu, Jan 29, 2009 at 5:08 PM, eulerss <[email protected]> wrote:
>
> > i was checking my example and i think that it doesn't work propertly,
> > for instance, if i type "p" all options appears, like
>
> > alve
> > alvr
> > ..
> > per
> > par
> > por
> > ...
> > zer
> > zae
>
> > and must appear the options that start with "p", isn't it?
> > here is my code
>
> > <form name="tarifas" method="post">
> > <table cellspacing="0" cellpadding="0" border="0">
> > <tr>
> > <td width="70" class="texto4">cliente:</td>
> > <td width="200">
> > <input type="text" id="autocomplete"
> > name="autocomplete_parameter"/
>
> > <span id="indicator1" style="display: none">
> > <img src="/images/spinner.gif"
> > alt="Working..." />
> > </span>
> > <div id="autocomplete_choices"
> > class="autocomplete"></div>
>
> > </td>
> > </tr>
> > </table>
>
> > <script type="text/javascript">
> > new Ajax.Autocompleter("autocomplete",
> > "autocomplete_choices",
> > "li.php", {
> > paramName: "value",
> > minChars: 2,
> > indicator: 'indicator1'
> > })
>
> > </script>
> > </form>
>
> > eulerss
>
> > On 29 ene, 09:27, eulerss <[email protected]> wrote:
> >> thanks a lot for you replay "disccomp", now it works, i think that i
> >> was correct, because i only change the libraries for that one that you
> >> put in the replay,my doubt is that in the past i was usig this
> >> libraries in order to implement dependent selects and it works
> >> perfectly, now i need to check my libraries, thanks again
>
> >> eulerss
>
> --
> Lars Schwarz
> Heiligengeiststr. 26
> 26121 Oldenburg
> T 0441 36110338
> M 0151 1727 8127
> Wwww.bitrocker.com- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---