Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #15916
| From | Gregor Kofler <usenet@gregorkofler.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: jQuery and autosuggest and more |
| Date | 2012-09-16 23:15 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <k35fia$28d$1@dont-email.me> (permalink) |
| References | <18804e03-6897-49e6-99df-c85e0f98c6e0@d6g2000yqd.googlegroups.com> <k32fs2$l21$1@dont-email.me> <bc2fc3e1-bc69-46cb-bedf-0ef5f4af3e2c@n9g2000yqn.googlegroups.com> <k32sh4$7mp$1@dont-email.me> <8f640263-98c2-43ab-8fd9-53ab3e5c1ca5@a11g2000yqb.googlegroups.com> |
Am 2012-09-16 00:48, justaguy meinte:
> On Sep 15, 5:38 pm, Gregor Kofler <use...@gregorkofler.com> wrote:
>> Am 2012-09-15 21:11, justaguy meinte:
>>
>>> ok, thanks, now you've open the Pandora's box,.. I have more questions
>>> for you.
>>> a) what do you think of this jQuery's autosuggest plug-in? it looks
>>> good.
>>
>> I have no idea. I use my own library and my own autosuggest widget.
>>
>> http://vxweb.net/autosuggest
>>
>> small, flexible, gets the job done - all of the time I need it.
>>
>> With some additional code, I end up with things like that:
>>
>> http://vxweb.net/xhrpicker
>>
>>> b) how to construct a query for ms sql server?
>>> similar to the following
>>> $query = mysql_query("SELECT * FROM my_table WHERE my_field LIKE '%
>>> $input%'");
>>
>> Er... yes. Mine look something like that. Though the WHERE clause makes
>> more sense with my_field LIKE '{$input}%' - Naturally, the $input value
>> has to be validated before processing. Get the query result, encode it
>> properly as whatever your library prefers (I suppose JSON). Return the
>> JSON string. Firebug can tell you all those details.
>>
>> Gregor
>
> Wow, it's very elegant. The third one (Suggest3), autosuggest +
> populating another field with a value is very close to what I need.
> In my case, I need to
> first apply autosuggest (retrieving data from a database), then
> populate named or ided field2 and field3 with related data.
RTFS:
var as = vxJS.widget.autoSuggest(
document.getElementById("suggestInput"),
{ command: "gimmethedata" },
{
maxEntries: 15,
searchMode: true,
keyElem: document.getElementById("keyInput")
}
);
will fill an additional key input with data, upon picking a suggestion.
If you need to fill an arbitrary number of fields you can forget about
the keyElem reference (it's there for convenience). Instead a
vxJS.event.addListener(as, "choose", function() {
var chosen = this.getChosen();
ElementReference1.value = chosen.customValue1;
ElementReference2.value = chosen.customValue2;
...
}
would do the trick.
> I would think your library might be able to tweak it as well. Next
> question is, how do we trigger a sql query against a ms sql server
> database?
POST contains a JSON encoded xmlHttpRequest field - decode it, get it's
text property (that's what was typed) and do your query.
Your response is again JSON encoded and contains an "entries" array.
Every array entry should at least hold an "id" (in this case not
required, though), a "text" property (the line of text shown) with each
entry and - in this special case a "customValue1" through "customValueN"
property. The rest is up to you. Again: Firebug or Chrom(e|ium) debugger
are very helpful with that.
> And it would be extremely Helpful if you could have another
> page that have Only the samples (sample fields) and their functions.
Dunno whether this will ever happen - in the meantime one has stick to
the page source.
Gregor
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-15 08:19 -0700
Re: jQuery and autosuggest and more Gregor Kofler <usenet@gregorkofler.com> - 2012-09-15 20:02 +0200
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-15 12:11 -0700
Re: jQuery and autosuggest and more Gregor Kofler <usenet@gregorkofler.com> - 2012-09-15 23:38 +0200
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-15 15:48 -0700
Re: jQuery and autosuggest and more Gregor Kofler <usenet@gregorkofler.com> - 2012-09-16 23:15 +0200
Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 12:51 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 14:42 -0700
Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 15:38 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 16:31 -0700
Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 17:01 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 17:58 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 18:19 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 19:47 -0700
Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 22:17 -0700
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 22:32 -0700
Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 23:22 -0700
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 23:59 -0700
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-18 02:08 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-18 05:46 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-18 07:50 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-18 08:07 -0700
Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-18 12:03 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-18 12:58 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-18 13:42 -0700
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-18 14:24 -0700
Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-18 15:34 -0700
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-18 15:40 -0700
Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-19 09:30 -0700
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-19 11:45 -0700
Re: jQuery and autosuggest and more Christoph Becker <cmbecker69@gmx.de> - 2012-09-18 02:04 +0200
Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 17:52 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 18:17 -0700
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 19:45 -0700
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 19:44 -0700
Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 18:00 -0700
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 20:12 -0700
Re: jQuery and autosuggest and more Christoph Becker <cmbecker69@gmx.de> - 2012-09-19 01:54 +0200
Re: jQuery and autosuggest and more "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2012-09-18 17:45 -0700
Re: jQuery and autosuggest and more Christoph Becker <cmbecker69@gmx.de> - 2012-09-19 16:46 +0200
Re: jQuery and autosuggest and more Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-20 21:35 +0200
Re: jQuery and autosuggest and more Christoph Becker <cmbecker69@gmx.de> - 2012-09-21 17:14 +0200
Re: jQuery and autosuggest and more Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-21 19:05 +0200
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-18 18:00 -0700
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 19:54 -0700
Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 22:53 -0700
Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 23:34 -0700
csiph-web