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 IE http://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 AM To: talk@webdna.us Subject: Re: [WebDNA] WebDNA autosuggest 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 article http://www.webreference.com/programming/javascript/ncz/column3/3.html 2) replace the suggestions.php with suggestions.tpl suggestions.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 or whatever suggestion terms you want. This shows reading from db, to write do the same thing but have your template append or replace or... Enjoy - Jim ps Original AJAX article: http://www.adaptivepath.com/publications/essays/archives/000385.php pps Google 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 it to 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 been written 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 an ajax >>>> tool to allow an 'atuosuggest' 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. >>>> >>>> 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 2500 schools >>>> 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' the result of >>>> stuff that I don't want - like the opening "" which the js >>>> above won't want to see at all, and maybe some line-feeds or other characters >>>> 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 the results 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 JSON format >>>> 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 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:

    
  1. Re: [WebDNA] WebDNA autosuggest ("Diane Blackmore (Cohesion)" 2010)
  2. RE: [WebDNA] WebDNA autosuggest ("Olin Lagon" 2010)
  3. Re: [WebDNA] WebDNA autosuggest (christophe.billiottet@webdna.us 2010)
  4. Re: [WebDNA] WebDNA autosuggest (Govinda 2010)
  5. Re: [WebDNA] WebDNA autosuggest (Stuart Tremain 2010)
  6. Re: [WebDNA] WebDNA autosuggest ("Diane Blackmore (Cohesion)" 2010)
Here is an example of a WebDNA autosuggest that works in IE http://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 AM To: talk@webdna.us Subject: Re: [WebDNA] WebDNA autosuggest 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 article http://www.webreference.com/programming/javascript/ncz/column3/3.html 2) replace the suggestions.php with suggestions.tpl suggestions.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 or whatever suggestion terms you want. This shows reading from db, to write do the same thing but have your template append or replace or... Enjoy - Jim ps Original AJAX article: http://www.adaptivepath.com/publications/essays/archives/000385.php pps Google 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 it to 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 been written 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 an ajax >>>> tool to allow an 'atuosuggest' 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. >>>> >>>> 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 2500 schools >>>> 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' the result of >>>> stuff that I don't want - like the opening "" which the js >>>> above won't want to see at all, and maybe some line-feeds or other characters >>>> 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 the results 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 JSON format >>>> 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 to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug 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)