22845 Posts in 9589 Topics by 2801 members
|Go to End|
27 April 2009 at 1:00pm
I have been trying out a new autocomplete field in a SilverStripe site I have been working on.
My main difficulty was finding a decent implementation that loaded fairly fast. I did find one (http://www.beauscott.com/2008/06/05/autocompletejs-update-12/) that I am pleased with, but I am still in difficulties as it requires more recent versions of Prototype (22.214.171.124) & Scriptaculous (1.8.1) than those that come with SilverStripe 2.3.1.
These new versions are not backwardly compatible with core SilverStripe code (messes up the CMS greatly).
I tried installing the newer libraries separately, and calling them directly from the pages I require them for, but this is not working 100%.
Essentially, the issue is that I would need to ensure the libraries in the jsparty folder only load in the CMS backend, and my new libraries only load in the front end.
This is tricky to do, but not impossible. My question is though:
1) Is it practical? Will I be forever firefighting problems?
2) Is there a more elegant way to do this?
27 April 2009 at 1:10pm
Requirements::block( .... outdated files .....)
make sure this codes only runs when the field shows and not in other circumstances.
I think that should work.
However, if possible, I would look at something that uses jQuery as this is the preferred JS library.
28 April 2009 at 10:23pm
Thanks Nicolaas, yes, I had those in, but I was finding that the script was intermittently breaking nonetheless.
I think the reason for this was the login page (which is used in the front end) was calling the jsparty versions and this was causing things to get complicated!
I have since switched to a jquery solution as you suggested. No sense in swimming against the tide!
There is a working demo of it up at: http://www.cashtrack.co.nz/ (the location field on the form to the right)
I will publish a code example when I have it working better (code isn't 100% reusable yet).
|Go to Top|