Forums

chronoform and js file

mariospapa 30 May, 2010
Hello,
I want to put in a form the MooTools DatePicker from here (http://www.monkeyphysics.com/mootools/script/2/datepicker). It uses MooTools Core v1.2+ and some other .js files. I put all the required files in a folder called "datepicker" and copied it to "includes/js/datepicker". Then I created a simple form and wrote in the field "Form Code ---> CSS Styles (May override Chronoforms CSS)" all the required commands like this:
<link rel="stylesheet" href="includes/js/datepicker/datepicker_vista.css" type="text/css" />
<script type="text/javascript" src="includes/js/datepicker/mootools-1.2.4-core-nc.js"></script>
<script type="text/javascript" src="includes/js/datepicker/datepicker.js"></script>

<script type="text/javascript">
window.addEvent('load', function() {
	new DatePicker('.ranged', {
		pickerClass: 'datepicker_vista',
		inputOutputFormat: 'd-m-Y',
		yearPicker: false,
		allowEmpty: false,
		toggleElements: '.date_toggler'
	});
});
</script>


But i can't see the desired result and the java scripts are not working well! What is happening?
GreyHead 30 May, 2010
Hi mariospapa,

Unfortunately Joomla 1.5 and ChronoForms use MooTools 1.1 (not 1.2) and the two libraries can't both be used together.

If you are prepared to do some work it is possible to use MooTools 1.1 in the front-end of your site. You will need to look at the new MooTools 'upgrade helper' and check that any script that you are using is amended to work with MooTools 1.2.

I've done this for a small site with very few pages and a single for From memory it wasn't too difficult. (The back-end of Joomla uses a lot more JvaScript and I wouldn't recommend the exercise.)

Bob
mariospapa 31 May, 2010
Thanks GreyHead!

But how i can use a java script which uses MooTools v1.1??? MooTools are loaded by default with Joomla? Should i have to install a plugin in order to enable it?

If i want to work with the aforementioned script for date picker which uses MooTools v1.2 and use this http://www.dwightjack.com/diary/2009/06/07/use-mootools-122-in-joomla-15 how i can embed the script in a chronoform?
GreyHead 01 Jun, 2010
Hi mariospapa,

The MooTools 1.1 library is often but not always loaded by Joomla. It is usually loaded by ChronoForms if you have validation or republish enabled.

You will not be able to use the MooTools 1.2 library with ChronoForms if you want any of the JavaScript dependent features enabled unless you make the changes to the ChronoForms scripts to work with MooTools 1.2. These changes are not difficult but are not trivial either.

The MooTools Upgrade Helper is designed to help with this and may well be a better resource than the one you linked to.

The upgrade is possible but will probably take you several hours if you are familiar with the scripts. Unless the calendar is **vital** to your project you'd be better to look for another solution using MooTools 1.1

Bob
This topic is locked and no more replies can be posted.