chronoform and js file

ma 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?
Gr 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
Gr 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.