Re: [WebDNA] WebDNA autosuggest
This WebDNA talk-list message is from 2010
It keeps the original formatting.
numero = 105710
interpreted = N
texte = Ooops, sorry, it was from Jim Lanford... here his original email:I've been using Ajax since Sept 05. Works with Explorer, Firefox, =Safari etc. I posted this 2005/08/04 16:20:51 - still in the archives,....How do you have JavaScript put stuff into WebDNA?Its easy.This sample shows how to do a similar Google autosuggest.1) get this sample code listed in this articlehttp://www.webreference.com/programming/javascript/ncz/column3/3.html2) replace the suggestions.php with suggestions.tplsuggestions.tpl[search db=3Ddb/suggestions.db&bwSTATEdatarq=3D[userInput]&STATEsort=3D1][[founditems]"[state]" ,[/founditems][/search]]create suggestions.db (field name of state) with a list of states orwhatever suggestion terms you want.This shows reading from db, to write do the same thing but have yourtemplate append or replace or...Enjoy- JimpsOriginal AJAX article:http://www.adaptivepath.com/publications/essays/archives/000385.phpppsGoogle maps is left as an exercise to the reader :-)On Aug 16, 2010, at 23:24, Stuart Tremain wrote:> Sorry>=20> It wasn't written by me, I think that Chris has inadvertently credited =it to me.>=20> Regards>=20> Stuart Tremain> IDFK Web Developments> AUSTRALIA> webdna@idfk.com.au>=20>=20>=20>=20> On 17/08/2010, at 12:17 PM, Diane Blackmore (Cohesion) wrote:>=20>> Hi>>=20>> I've had this in use with a few development sites, and have only just>> realised that it doesn't work in IE... Eeeeek. Kinda important stuff.>>=20>> Since it's a great autosuggest, could Stuart or someone get this =working>> please - Javascript isn't my strength but the syntax is apparently =out at>> char 13 on line 42 of 'remotesuggestion.js'.>>=20>>=20>> Thanks,>>=20>>=20>> on 18/3/10 11:13 PM, christophe.billiottet@webdna.us at>> christophe.billiottet@webdna.us wrote:>>=20>>> There is an autosuggest in the site resources download. It as been =written by>>> Stuart and works quite well: http://www.webdna.us/page.dna?numero=3D5>>>=20>>> - chris>>>=20>>>=20>>> On Mar 18, 2010, at 0:01, Diane Blackmore (Cohesion) wrote:>>>=20>>>> Hi>>>>=20>>>> My experience with ajax is limited but I have done some. I needed =an ajax>>>> tool to allow an =91atuosuggest=92 function (like Google has to =make suggestions>>>> after a few letters/words have been typed). Found one (and a good =one) but I>>>> cannot get it to work when using a URL to gather the data object =rather than>>>> just using a string in the js itself.>>>>=20>>>> Jquery tool is AutoSuggest: Docs found at>>>> http://code.drewwilson.com/entry/autosuggest-jquery-plugin>>>> I=92m using it under jQuery 1.3.2.>>>>=20>>>> Here is the code that works;>>>>=20>>>>> >>>>=20>>>> Or in raw format;>>>>=20>>>>> >>>>=20>>>>=20>>>>=20>>>>=20>>>> Looks fine, except that when db is actually complete there=92ll be =2500 schools>>>> so we don=92t want that listed on the page. Therefore we need to =call the>>>> search on another page... Which is what I usually do, however in =this>>>> instance I don=92t seem to be getting the opportunity to =91clean=92 =the result of>>>> stuff that I don=92t want =96 like the opening =93=94= which the js>>>> above won=92t want to see at all, and maybe some line-feeds or =other characters>>>> also.=20>>>>=20>>>> Usually clean data with replace(/\s*/, "")>>>>=20>>>> Code to use a URL rather than a data string as above is;>>>>>=20>>>>> >>>>=20>>>>=20>>>> ... Where =91_findSchools.csn=92 is the page doing the WebDNA =processing as>>>> follows;>>>>=20>>>>=20>>>>> >>>>> [search=20>>>>> =db=3D../db/schools.db&geschooliddatarq=3D1&eqsch_livedatarq=3DT&asschool_n=amesort=3D>>>>> 1][founditems]{value: "[schoolid]", name: "[school_name]"}[hideif>>>>> [index]=3D[numfound]],[/hideif][/founditems][/search]>>>>=20>>>> However this doesn=92t come back with a valid format even when the =results are>>>> pasted straight in to the =93_findSchools.csn=94 page. Tried adding>>>> [SETMIMEHEADER name=3DContent-type&value=3Dapplication/json] since =the PHP>>>> example had a similar thing but no luck there either.>>>>=20>>>> PHP =91example=92 provided by plugin app developer reads;>>>>=20>>>>> >>>>> $input =3D $_GET["q"];>>>>> $data =3D array();>>>>> // query your DataBase here looking for a match to $input>>>>> $query =3D mysql_query("SELECT * FROM my_table WHERE my_field =LIKE>>>>> '%$input%'");>>>>> while ($row =3D mysql_fetch_assoc($query)) {>>>>> $json =3D array();>>>>> $json['value'] =3D $row['id'];>>>>> $json['name'] =3D $row['username'];>>>>> $json['image'] =3D $row['user_photo'];>>>>> $data[] =3D $json;>>>>> }>>>>> header("Content-type: application/json");>>>>> echo json_encode($data);>>>>> ?>>>>>=20>>>>=20>>>>=20>>>> Basically, can anyone tell me how I can get the data back in the =JSON format>>>> it needs, without the extra WebDNA stuff that it doesn=92t need.>>>>=20>>>>=20>>>> Thanks heaps if you can help,>>>>=20>>>>=20>>>>=20>>>>
>>>=20>>> --------------------------------------------------------->>> This message is sent to you because you are subscribed to>>> the mailing list .>>> To unsubscribe, E-mail to: >>> archives: http://mail.webdna.us/list/talk@webdna.us>>> old archives: http://dev.webdna.us/TalkListArchive/>>> Bug Reporting: =http://forum.webdna.us/eucabb.html?page=3Dtopics&category=3D288>>>=20>>>=20>>=20>>=20>>=20>>=20>>=20>> --------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list .>> To unsubscribe, E-mail to: >> archives: http://mail.webdna.us/list/talk@webdna.us>> Bug Reporting: support@webdna.us>=20> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> Bug Reporting: support@webdna.us
Associated Messages, from the most recent to the oldest:
Ooops, sorry, it was from Jim Lanford... here his original email:I've been using Ajax since Sept 05. Works with Explorer, Firefox, =Safari etc. I posted this 2005/08/04 16:20:51 - still in the archives,....How do you have JavaScript put stuff into WebDNA?Its easy.This sample shows how to do a similar Google autosuggest.1) get this sample code listed in this articlehttp://www.webreference.com/programming/javascript/ncz/column3/3.html2) replace the suggestions.php with suggestions.tplsuggestions.tpl[search db=3Ddb/suggestions.db&bwSTATEdatarq=3D[userInput]&STATEsort=3D1][[founditems]"[state]" ,[/founditems][/search]]create suggestions.db (field name of state) with a list of states orwhatever suggestion terms you want.This shows reading from db, to write do the same thing but have yourtemplate append or replace or...Enjoy- JimpsOriginal AJAX article:http://www.adaptivepath.com/publications/essays/archives/000385.phpppsGoogle maps is left as an exercise to the reader :-)On Aug 16, 2010, at 23:24, Stuart Tremain wrote:> Sorry>=20> It wasn't written by me, I think that Chris has inadvertently credited =it to me.>=20> Regards>=20> Stuart Tremain> IDFK Web Developments> AUSTRALIA> webdna@idfk.com.au>=20>=20>=20>=20> On 17/08/2010, at 12:17 PM, Diane Blackmore (Cohesion) wrote:>=20>> Hi>>=20>> I've had this in use with a few development sites, and have only just>> realised that it doesn't work in IE... Eeeeek. Kinda important stuff.>>=20>> Since it's a great autosuggest, could Stuart or someone get this =working>> please - Javascript isn't my strength but the syntax is apparently =out at>> char 13 on line 42 of 'remotesuggestion.js'.>>=20>>=20>> Thanks,>>=20>>=20>> on 18/3/10 11:13 PM, christophe.billiottet@webdna.us at>> christophe.billiottet@webdna.us wrote:>>=20>>> There is an autosuggest in the site resources download. It as been =written by>>> Stuart and works quite well: http://www.webdna.us/page.dna?numero=3D5>>>=20>>> - chris>>>=20>>>=20>>> On Mar 18, 2010, at 0:01, Diane Blackmore (Cohesion) wrote:>>>=20>>>> Hi>>>>=20>>>> My experience with ajax is limited but I have done some. I needed =an ajax>>>> tool to allow an =91atuosuggest=92 function (like Google has to =make suggestions>>>> after a few letters/words have been typed). Found one (and a good =one) but I>>>> cannot get it to work when using a URL to gather the data object =rather than>>>> just using a string in the js itself.>>>>=20>>>> Jquery tool is AutoSuggest: Docs found at>>>> http://code.drewwilson.com/entry/autosuggest-jquery-plugin>>>> I=92m using it under jQuery 1.3.2.>>>>=20>>>> Here is the code that works;>>>>=20>>>>> >>>>=20>>>> Or in raw format;>>>>=20>>>>> >>>>=20>>>>=20>>>>=20>>>>=20>>>> Looks fine, except that when db is actually complete there=92ll be =2500 schools>>>> so we don=92t want that listed on the page. Therefore we need to =call the>>>> search on another page... Which is what I usually do, however in =this>>>> instance I don=92t seem to be getting the opportunity to =91clean=92 =the result of>>>> stuff that I don=92t want =96 like the opening =93=94= which the js>>>> above won=92t want to see at all, and maybe some line-feeds or =other characters>>>> also.=20>>>>=20>>>> Usually clean data with replace(/\s*/, "")>>>>=20>>>> Code to use a URL rather than a data string as above is;>>>>>=20>>>>> >>>>=20>>>>=20>>>> ... Where =91_findSchools.csn=92 is the page doing the WebDNA =processing as>>>> follows;>>>>=20>>>>=20>>>>> >>>>> [search=20>>>>> =db=3D../db/schools.db&geschooliddatarq=3D1&eqsch_livedatarq=3DT&asschool_n=amesort=3D>>>>> 1][founditems]{value: "[schoolid]", name: "[school_name]"}[hideif>>>>> [index]=3D[numfound]],[/hideif][/founditems][/search]>>>>=20>>>> However this doesn=92t come back with a valid format even when the =results are>>>> pasted straight in to the =93_findSchools.csn=94 page. Tried adding>>>> [SETMIMEHEADER name=3DContent-type&value=3Dapplication/json] since =the PHP>>>> example had a similar thing but no luck there either.>>>>=20>>>> PHP =91example=92 provided by plugin app developer reads;>>>>=20>>>>> >>>>> $input =3D $_GET["q"];>>>>> $data =3D array();>>>>> // query your DataBase here looking for a match to $input>>>>> $query =3D mysql_query("SELECT * FROM my_table WHERE my_field =LIKE>>>>> '%$input%'");>>>>> while ($row =3D mysql_fetch_assoc($query)) {>>>>> $json =3D array();>>>>> $json['value'] =3D $row['id'];>>>>> $json['name'] =3D $row['username'];>>>>> $json['image'] =3D $row['user_photo'];>>>>> $data[] =3D $json;>>>>> }>>>>> header("Content-type: application/json");>>>>> echo json_encode($data);>>>>> ?>>>>>=20>>>>=20>>>>=20>>>> Basically, can anyone tell me how I can get the data back in the =JSON format>>>> it needs, without the extra WebDNA stuff that it doesn=92t need.>>>>=20>>>>=20>>>> Thanks heaps if you can help,>>>>=20>>>>=20>>>>=20>>>> >>>=20>>> --------------------------------------------------------->>> This message is sent to you because you are subscribed to>>> the mailing list .>>> To unsubscribe, E-mail to: >>> archives: http://mail.webdna.us/list/talk@webdna.us>>> old archives: http://dev.webdna.us/TalkListArchive/>>> Bug Reporting: =http://forum.webdna.us/eucabb.html?page=3Dtopics&category=3D288>>>=20>>>=20>>=20>>=20>>=20>>=20>>=20>> --------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list .>> To unsubscribe, E-mail to: >> archives: http://mail.webdna.us/list/talk@webdna.us>> Bug Reporting: support@webdna.us>=20> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> Bug Reporting: support@webdna.us
christophe.billiottet@webdna.us
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
can WC render sites out? (1997)
Apache SSL and Linux (2002)
OT: MSN.com no email (2003)
send mail problem? (1997)
Include a big block of text (1997)
Protect (1997)
Mass Mail (2000)
Re(2): Foreign Chars ( יאצה and so on) (1998)
RE:ShowIf & HideIf Question? (1998)
suffix mapping for NT? (1997)
Verifying both name and password (was: New Problem) (1997)
[format xs] freeze (1997)
Problems passing [SKU] with $Replace in 2.0 (1997)
RE: creating writefile data from a nested search (1997)
Check for OS (2003)
Couple of questions (1999)
Summing fields (1997)
[WriteFile] problems (1997)
addlineitems within formvariable loop (1998)
date and time stamp (2003)