Dec 04, 2008, 12:44 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
Pages: [1] 2 3 ... 6   Go Down
  Print  
Author Topic: [Snippet] AjaxSearch  (Read 21271 times)
0 Members and 1 Guest are viewing this topic.
kylej
Coding Team
*
Posts: 738



WWW
« on: Mar 18, 2006, 03:07 PM »

With all of the AJAX talk going around I thought it was time to add some to my site. This snippet turns the FlexSearchForm snippet into an AJAX site search. The results from the search are loaded right in the page for the user. If the user does not have javascript enabled, the snippet will use the default searching of the FlexSearchForm snippet.

The javascript code is based off of the example by Steve Smith of orderedlist.com.

If you would like to see this in action you can go to my site here:

http://www.muddydogpaws.com/notebook/ajax-search-snippet.html

The instructions for installing and setting up this snippet are in the FSFAjax_readme.txt file in the zip.

Enjoy,
 
Kyle

Updated: 05/18/2006 - I have added the code from Thomas (Shadock) to the main snippet to allow for live searching (i.e. results as you type).  There is a new parameter that goes along with this.  If you add the parameter &ajaxSearchType=`1` you will turn on the live search.  I have also updated the scriptaculous effects to run in succession so the effects look better.

Updated: 04/03/2006 - To make the search even better, I have added the search highlighting code from Marc (MadeMyDay). The updated code can be found in the download. You need to update all of the files excluding the images for this to work correctly.

Updated: 03/20/2006 - After receiving some feedback I have modified the snippet a little. There is now a button that appears to close the search box after a search. Also I have made the snippet output the parameters set in the snippet to a bit of javascript so that I can use them in the ajax call. So you do not have to update the file ajaxSearch.php for your search settings. A thank you goes out to sottwell for these great ideas.

*******Update: 03/19/06***********
I added a button to close the seach box after you run the search.  Great idea Susan.  I have updated the zip here and on my site.  The only file I had to change was the javascript file, so that is the only one you need to update.


Mod note: File removed: ajaxSearch.zip (19.93 KB - downloaded 76 times.)
Please visit the AjaxSearch Repository entry for downloads.
« Last Edit: Aug 22, 2006, 08:10 AM by PaulGregory » Logged

davidm
Marketing & Design Team
*
Posts: 6,777


The best way to predict the future is to invent it


WWW
« Reply #1 on: Mar 18, 2006, 05:46 PM »

I just love the livesearch, very nice one !

Just a problem : the archive above is corrupt can't download it... Got it from your website though, and will try it tomorrow...

Thanks a lot for this one Grin
Logged

.: nodeo.net : Pour un web libre, moderne et ouvert ! :: david-molliere.net : Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web :.

*** Forums modxcms.fr Participez à l'élaboration du site MODx francophone ! ***

! Nouveau !  En live, ne manquez pas les news de modxcms.fr sur Twitter   ! Nouveau !

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.6 | Debian 4.0 (Etch)

Réalisations sous MODx : | pargade-notaires.fr | soleil.info | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | jocelyne-violet.net
doze
Coding Team
*
Posts: 3,237


....Boom!


« Reply #2 on: Mar 18, 2006, 05:50 PM »

Yes, great work again Kyle! I like it alot, and will definitely use. Thanks!
Logged

MODxWiki || Please, list wiki worthy material here!
kylej
Coding Team
*
Posts: 738



WWW
« Reply #3 on: Mar 18, 2006, 06:04 PM »

I have updated the file for download above.
Logged

garryn
Coding Team
*
Posts: 1,181



WWW
« Reply #4 on: Mar 18, 2006, 07:10 PM »

Cool snippet! Cool  I will definitely give this one a try.
Logged

Mark
Coding Team
*
Posts: 3,247


Ditto Developer


WWW
« Reply #5 on: Mar 18, 2006, 08:02 PM »

That is waaaaaaaaay cooler than the Etomite one I ported a while back... (never released due to various issues)
« Last Edit: Mar 19, 2006, 12:14 AM by Mark » Logged

Dr. Scotty Delicious
Coding Team
*
Posts: 1,172


Dr. of Fine Pirate Arts


WWW
« Reply #6 on: Mar 18, 2006, 11:56 PM »

I love it.  Thanks for sharing this man.  It is in use at my site now (see the sig).  Very clever piece of scripting.

-sD-
scotty Delicious
Logged

We pillage, we plunder, we rifle and loot. Drink up me 'earties, Yo Ho!
We kidnap and ravage and don't give a hoot. Drink up me 'earties, Yo Ho!
Yo Ho, Yo Ho! A pirate's life for me.
sottwell
Documentation Team
*
Posts: 8,170



WWW
« Reply #7 on: Mar 19, 2006, 12:04 AM »

Excellent! The only 'quibble' I could have is that it would be nice to be able to close the boxes. Maybe a button with something like this:

Code:
onclick="Effect.Fade(this)"
Logged

sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html
kylej
Coding Team
*
Posts: 738



WWW
« Reply #8 on: Mar 19, 2006, 09:03 AM »

Excellent! The only 'quibble' I could have is that it would be nice to be able to close the boxes. Maybe a button with something like this:

Code:
onclick="Effect.Fade(this)"


I have posted an updated version with this functionality included, great idea.
Logged

sottwell
Documentation Team
*
Posts: 8,170



WWW
« Reply #9 on: Mar 19, 2006, 09:22 AM »

Quote
# Open ajaxSearch.php and set the options for your search.*

Hmm...is there perhaps some way the snippet could generate a bit of javascript that loads an array of these values into the javascript scope, then they could be passed via the AJAX call as params?
Logged

sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html
kylej
Coding Team
*
Posts: 738



WWW
« Reply #10 on: Mar 19, 2006, 11:58 AM »

That sounds like it could be possible, Ihadn't thought of doing it that way.  Has anyone used a snippet to do this before?  If not I will have to look into doing it.  I think it sounds like a good idea.
Logged

rthrash
Foundation
*
Posts: 9,575



WWW
« Reply #11 on: Mar 19, 2006, 01:54 PM »

Out of curiosity, what happens if someone happens to have JS turned off with this... does it degrade and work like a regular old search form?
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
doze
Coding Team
*
Posts: 3,237


....Boom!


« Reply #12 on: Mar 19, 2006, 02:11 PM »

If the user does not have javascript enabled, the snippet will use the default searching of the FlexSearchForm snippet.
Looking at this quote from the first post, I would guess "yes"..  Wink Grin
Logged

MODxWiki || Please, list wiki worthy material here!
kylej
Coding Team
*
Posts: 738



WWW
« Reply #13 on: Mar 19, 2006, 04:23 PM »

Yep, it works just like the old search form.  I use javascript to change the functionality of the form, so if there is no javascript, it does the original form action.
Logged

rthrash
Foundation
*
Posts: 9,575



WWW
« Reply #14 on: Mar 19, 2006, 10:52 PM »

And then some days, you just don't read... Wink
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
Pages: [1] 2 3 ... 6   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!