Forums

installing jQuery , Date picker , joomla 2.5 with Chronoforms v4

paint27 26 Apr, 2014
getting jquery date picker to work in Chrono forms v4: in Joomla 2.5

Ok I spent the past week futzing with this and there isn't any concise tutorials online that were helpful to me , so I'm posting how I got this to work. the date picker tutorial here is geared towards joomla 3, and the instructions weren't working on joomla 2.5 for me .

I still never found an explanation of which library was best for joomla 2.5 BUT I did eventually find a very well written plug-in extension for getting jQuery loaded into joomla 2.5. these were my findings , I hope they next person won't have to get as many grey hairs as me futzing through the internetz trying to find this relatively easy fix. .




jQuery Library Settings overview

install this plug in:

http://www.joomlabamboo.com/joomla-extensions/jb-library-plugin-a-free-joomla-jquery-plugin

promising.. loads it correctly..
test it on your site by going into the plugin settings and setting these toggles :


System - JB Library

Scripts Handler:
Use Script Loader: Yes
Move Scripts to Bottom: Yes (default)

jQuery Library Settings
Load jQuery: Yes
jQuery Source: Local
jQuery Version: 1.8.3 min <- one I am currently using
jQuery No-Conflict: ENABLED < this is check to make sure multiple libraries aren't loading on top of each other.
Remove other jQuery: Yes <- if libraries ARE double loading it will clear them out to prevent conflicts, this was the big issue I had with other plugins they didn't do this check
Regex for jQuery file: ([\/a-zA-Z0-9_:\.-]*)jquery([0-9\.-]|min|pack)*?.js <-- default setting


Mootools Settings

Handle Mootools: Yes
Remove Mootools Core: No
Replace Mootools Library: No
Remove Mootools More:No
Replace Mootools More Library:No

Add Other Scripts
(I currently have this blank)

Strip Other Scripts
Strip Other Scripts: No

ie6 Bad Browser Warning
ie6 Warning: Enabled


Scroll to Top Button ** enable this as a check to see if jQuerry has installed correctly just a quick visual.
But after 2 weeks of horrid tutoris seeing this made me do a happy dance.


Add Scroll To Top Button?: Enabled
Back to top button style: Light
Translate Scroll To Top Text:Enabled
Scroll to text : BACK_TO_TOP

Lazy Load Images
Enable Lazy Load?: disabled


_______________________________________________________________


in Chrono Forums v4:


add in the Elements tab :

Custom Element (HTML/PHP)

Field Name: *BLANK*
Field ID :*BLANK*
Label Text: Calander
Pure code (check this box)

Code:
[code]<div id="datepicker"></div>
<input type='hidden' name='calendar_date' id='calendar_date' value='' />
[/code
click [b] Apply[/b]

_______________________________________

on the events Tab:


drag drop in a Custom Code event in the First place before show HTML:

This loades the calander plugin

Custom Code:

Mode: Controller

Action Label: *Blank*

Code:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>datepicker demo</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
</head>
<body>

<div id="datepicker"></div>
 
<script>
$( "#datepicker" ).datepicker();
</script>


___________________________________

next Underneath the Show HTML add a Load JS event from the utilities menu.

This is where you configure your calendar, in My case I only want people to be able to pick the current days date . BUT this is extremely configurable , even as selective blocks of days or only certain days of the week , all those settings are in the jQury date picker documentation.
http://jqueryui.com/datepicker/

Plop in your JS Loader in the on load section , under show html.


JS Loader settings
Dynamic File: No

Code:
jQuery(function() {
  jQuery('#datepicker').datepicker(
    {
      minDate: 0,
      prevText: '',
      nextText: '',
      maxDate: '+0d',
      firstDay: 1,
      dateFormat: 'mm/dd/yy',
      onSelect: function(dateText, inst) {
      jQuery('#calendar_date').val(dateText);
    }
  });
});



____________________________________


now just add your debuggers and make sure you have a submit button to test and build away the rest of the forum.
I tested mine with both the debugger and made sure it sent it to my email..



i'll update with any bugs/or nuances I come across.
GreyHead 26 Apr, 2014
Hi paint27,

Just curious - why did you need the jQuery datepicker?

Bob
paint27 26 Apr, 2014
In My case the client only wanted people to be able to pick the current days date .
It's for adoption applications and when given the option to select any day, people would.. :/
Which was making it extremely frustrating for the People in-charge of organizing the applications .
Originally i just removed the date picker and suggested that it was redundant because the filenames had a time stamp. they didn't want to just use the output in the file name, they wanted it included in the email.

The jQuery date picker gives the option to modify how dates are selected, being 1 day or several or just certain ones .
GreyHead 27 Apr, 2014
Hi paint27,

Then you could just add readonly input with the current date. Or you could set the MooTools datepicker to allow only the current date. Well done to get it working though.

Bob
paint27 27 Apr, 2014
All I need is for the date to visible in the email on submit. ideally I do not want the users to have any say in choosing the date, it needs to be static timestamp . ........** ADD moment** going to test an html include...*** . I know this seems like really simple but I know their are other pretty novice people out there that be looking to do something similar .

For Mootools their are no relevant easy to understand tutorials that are geared toward J 2.5. that I could find . or the few i did that had not been updated since 2007, or have a map to where to find the referenced css files that need configuring.
If I have to figure that out i'll document it and post it somewhere ,but it would be ideal if it is made a configurable option in the "configure" tab.

I did consider upgrading to V5 and I do have it installed , but there are still some features lacking so i'm waiting on that .

Tutorials that just say : "go configure your css" is not helpful at all when you aren't a programmer , and leaving out assumed pieces of data for us non-programmer designers is extremely frustrating. remember I'm using Joomla to begin with because it's easier to configure thru modules, and plug-ins.

I would of loved to of been able to just configure the default date picker. But the only tutorials I could find that really listed where to find any settings to configure were in jQuery date picker and even these have been near impossible since the same issue of assumed knowledge level is all over the web, or the tutorials haven't been updated in 5 years, or are not relevant to other versions of Joomla. ie: tutorials for 1.5/6 or 3.0, but not 2.5.
GreyHead 27 Apr, 2014
Hi paint27,

The way to set a date in the On Submit box is to use a Custom Code action with code like this:
<?php
$form->data['date'] = date('Y-md-d');
?>
and then put {date} in the email.

If you need the MooTools datepicker docs, they are here and there are a few FAQs here on specific settings.

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