Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

New Versions of Prototype & Scriptaculous


Reply


3 Posts   786 Views

Avatar
rbquirke

Community Member, 70 Posts

27 April 2009 at 1:00pm

Hi folks

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 (1.6.0.2) & 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?

Thanks

Ronan

Avatar
Nicolaas

Forum Moderator, 213 Posts

27 April 2009 at 1:10pm

I would

add:
Requirements::javascript( ... my new files ....)
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.

Avatar
rbquirke

Community Member, 70 Posts

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).

Ronan