RE: [WebDNA] WebDNA autosuggest
This WebDNA talk-list message is from 2010
It keeps the original formatting.
numero = 105711
interpreted = N
texte = Here is an example of a WebDNA autosuggest that works in IEhttp://www.kanuhawaii.org/signup/It is working on the zipcode.I used a jquery plugin. Happy to share if anyone is interested.-----Original Message-----From: christophe.billiottet@webdna.us[mailto:christophe.billiottet@webdna.us] Sent: Tuesday, August 17, 2010 12:14 AMTo: talk@webdna.usSubject: Re: [WebDNA] WebDNA autosuggestOoops, sorry, it was from Jim Lanford... here his original email:I've been using Ajax since Sept 05. Works with Explorer, Firefox, Safarietc. 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=db/suggestions.db&bwSTATEdatarq=[userInput]&STATEsort=1][[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> > It wasn't written by me, I think that Chris has inadvertently credited itto me.> > Regards> > Stuart Tremain> IDFK Web Developments> AUSTRALIA> webdna@idfk.com.au> > > > > On 17/08/2010, at 12:17 PM, Diane Blackmore (Cohesion) wrote:> >> Hi>> >> 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.>> >> 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'.>> >> >> Thanks,>> >> >> on 18/3/10 11:13 PM, christophe.billiottet@webdna.us at>> christophe.billiottet@webdna.us wrote:>> >>> There is an autosuggest in the site resources download. It as beenwritten by>>> Stuart and works quite well: http://www.webdna.us/page.dna?numero=5>>> >>> - chris>>> >>> >>> On Mar 18, 2010, at 0:01, Diane Blackmore (Cohesion) wrote:>>> >>>> Hi>>>> >>>> My experience with ajax is limited but I have done some. I needed anajax>>>> tool to allow an 'atuosuggest' function (like Google has to makesuggestions>>>> 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 ratherthan>>>> just using a string in the js itself.>>>> >>>> Jquery tool is AutoSuggest: Docs found at>>>> http://code.drewwilson.com/entry/autosuggest-jquery-plugin>>>> I'm using it under jQuery 1.3.2.>>>> >>>> Here is the code that works;>>>> >>>>> >>>> >>>> Or in raw format;>>>> >>>>> >>>> >>>> >>>> >>>> >>>> Looks fine, except that when db is actually complete there'll be 2500schools>>>> so we don't 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't seem to be getting the opportunity to 'clean' theresult of>>>> stuff that I don't want - like the opening "" whichthe js>>>> above won't want to see at all, and maybe some line-feeds or othercharacters>>>> also. >>>> >>>> Usually clean data with replace(/\s*/, "")>>>> >>>> Code to use a URL rather than a data string as above is;>>>>> >>>>> >>>> >>>> >>>> ... Where '_findSchools.csn' is the page doing the WebDNA processing as>>>> follows;>>>> >>>> >>>>> >>>>> [search >>>>>db=../db/schools.db&geschooliddatarq=1&eqsch_livedatarq=T&asschool_namesort=>>>>> 1][founditems]{value: "[schoolid]", name: "[school_name]"}[hideif>>>>> [index]=[numfound]],[/hideif][/founditems][/search]>>>> >>>> However this doesn't come back with a valid format even when theresults are>>>> pasted straight in to the "_findSchools.csn" page. Tried adding>>>> [SETMIMEHEADER name=Content-type&value=application/json] since the PHP>>>> example had a similar thing but no luck there either.>>>> >>>> PHP 'example' provided by plugin app developer reads;>>>> >>>>> >>>>> $input = $_GET["q"];>>>>> $data = array();>>>>> // query your DataBase here looking for a match to $input>>>>> $query = mysql_query("SELECT * FROM my_table WHERE my_field LIKE>>>>> '%$input%'");>>>>> while ($row = mysql_fetch_assoc($query)) {>>>>> $json = array();>>>>> $json['value'] = $row['id'];>>>>> $json['name'] = $row['username'];>>>>> $json['image'] = $row['user_photo'];>>>>> $data[] = $json;>>>>> }>>>>> header("Content-type: application/json");>>>>> echo json_encode($data);>>>>> ?>>>>> >>>> >>>> >>>> Basically, can anyone tell me how I can get the data back in the JSONformat>>>> it needs, without the extra WebDNA stuff that it doesn't need.>>>> >>>> >>>> Thanks heaps if you can help,>>>> >>>> >>>> >>>>
>>> >>> --------------------------------------------------------->>> 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=topics&category=288>>> >>> >> >> >> >> >> >> --------------------------------------------------------->> 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> > ---------------------------------------------------------> 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---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.usBug Reporting: support@webdna.us
Associated Messages, from the most recent to the oldest:
Here is an example of a WebDNA autosuggest that works in IEhttp://www.kanuhawaii.org/signup/It is working on the zipcode.I used a jquery plugin. Happy to share if anyone is interested.-----Original Message-----From: christophe.billiottet@webdna.us[mailto:christophe.billiottet@webdna.us] Sent: Tuesday, August 17, 2010 12:14 AMTo: talk@webdna.usSubject: Re: [WebDNA] WebDNA autosuggestOoops, sorry, it was from Jim Lanford... here his original email:I've been using Ajax since Sept 05. Works with Explorer, Firefox, Safarietc. 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=db/suggestions.db&bwSTATEdatarq=[userInput]&STATEsort=1][[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> > It wasn't written by me, I think that Chris has inadvertently credited itto me.> > Regards> > Stuart Tremain> IDFK Web Developments> AUSTRALIA> webdna@idfk.com.au> > > > > On 17/08/2010, at 12:17 PM, Diane Blackmore (Cohesion) wrote:> >> Hi>> >> 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.>> >> 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'.>> >> >> Thanks,>> >> >> on 18/3/10 11:13 PM, christophe.billiottet@webdna.us at>> christophe.billiottet@webdna.us wrote:>> >>> There is an autosuggest in the site resources download. It as beenwritten by>>> Stuart and works quite well: http://www.webdna.us/page.dna?numero=5>>> >>> - chris>>> >>> >>> On Mar 18, 2010, at 0:01, Diane Blackmore (Cohesion) wrote:>>> >>>> Hi>>>> >>>> My experience with ajax is limited but I have done some. I needed anajax>>>> tool to allow an 'atuosuggest' function (like Google has to makesuggestions>>>> 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 ratherthan>>>> just using a string in the js itself.>>>> >>>> Jquery tool is AutoSuggest: Docs found at>>>> http://code.drewwilson.com/entry/autosuggest-jquery-plugin>>>> I'm using it under jQuery 1.3.2.>>>> >>>> Here is the code that works;>>>> >>>>> >>>> >>>> Or in raw format;>>>> >>>>> >>>> >>>> >>>> >>>> >>>> Looks fine, except that when db is actually complete there'll be 2500schools>>>> so we don't 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't seem to be getting the opportunity to 'clean' theresult of>>>> stuff that I don't want - like the opening "" whichthe js>>>> above won't want to see at all, and maybe some line-feeds or othercharacters>>>> also. >>>> >>>> Usually clean data with replace(/\s*/, "")>>>> >>>> Code to use a URL rather than a data string as above is;>>>>> >>>>> >>>> >>>> >>>> ... Where '_findSchools.csn' is the page doing the WebDNA processing as>>>> follows;>>>> >>>> >>>>> >>>>> [search >>>>>db=../db/schools.db&geschooliddatarq=1&eqsch_livedatarq=T&asschool_namesort=>>>>> 1][founditems]{value: "[schoolid]", name: "[school_name]"}[hideif>>>>> [index]=[numfound]],[/hideif][/founditems][/search]>>>> >>>> However this doesn't come back with a valid format even when theresults are>>>> pasted straight in to the "_findSchools.csn" page. Tried adding>>>> [SETMIMEHEADER name=Content-type&value=application/json] since the PHP>>>> example had a similar thing but no luck there either.>>>> >>>> PHP 'example' provided by plugin app developer reads;>>>> >>>>> >>>>> $input = $_GET["q"];>>>>> $data = array();>>>>> // query your DataBase here looking for a match to $input>>>>> $query = mysql_query("SELECT * FROM my_table WHERE my_field LIKE>>>>> '%$input%'");>>>>> while ($row = mysql_fetch_assoc($query)) {>>>>> $json = array();>>>>> $json['value'] = $row['id'];>>>>> $json['name'] = $row['username'];>>>>> $json['image'] = $row['user_photo'];>>>>> $data[] = $json;>>>>> }>>>>> header("Content-type: application/json");>>>>> echo json_encode($data);>>>>> ?>>>>> >>>> >>>> >>>> Basically, can anyone tell me how I can get the data back in the JSONformat>>>> it needs, without the extra WebDNA stuff that it doesn't need.>>>> >>>> >>>> Thanks heaps if you can help,>>>> >>>> >>>> >>>> >>> >>> --------------------------------------------------------->>> 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=topics&category=288>>> >>> >> >> >> >> >> >> --------------------------------------------------------->> 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> > ---------------------------------------------------------> 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---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.usBug Reporting: support@webdna.us
"Olin Lagon"
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:
Web Catalog 2 demo (1997)
[WebDNA] Grep out square brackets? (2010)
Coding Technique (2000)
quantity minimum problem (1997)
WebCommerce: Folder organization ? (1997)
show all problem (1997)
Keep away (1997)
Re:2nd WebCatalog2 Feature Request (1996)
Confusing [protect] (long) (1999)
Forbidden CGI Error (1997)
Replacefounditems (2003)
WebCat2b12--[searchstring] bug (1997)
F3 crashing server (1997)
shipcost (1997)
RE: Languages (1997)
Null Chars (1999)
passing user info on each page (2000)
[GROUPS] followup (1997)
Grep search not working (2002)
Re:ListFields and [name] (1997)