Calendar plugin

GreyHead 26 May, 2008
Hi,

I had to create a form with several JavaScript calendars in it and thought it might be useful if I could have a simple way of implementing them. The result is this ChronoForms Plugin for Joomla 1.5.

All the JavaScript it uses is already installed with Joomla 1.5 and so you need no extra files.

To use it with your form, select the Form in the Form Manager and click the Calendar PlugIn link. (To start with just click Save without changing the date format parameter.)

In your form html include the following function call
<?php calendar('name text', 'field_name'); ?>
and check the output in your form. You should have an input field with a button beside it, click the button to see the JavaScript calendar.

Calendar plugin image 1


You may include several calendars in one form provided that they have different field names. All calendar results are returned in a single array $_POST['date_array'].

The calendar function can take more parameters thought these have default values that work in many cases:
<?php  calendar('name text', 'field_name', 
required=false, $id='field_name', value=""); ?>


Note: This is a beta version of the Plug In and may be buggy!! Please report any problems here.

To install, please use the extension installer in the Joomla admin. It will add a single file to your com_chronocontact/plugins folder. Once the installation is complete you can uninstall the extension.

Bob

[file name=com_cf_calendar_plugin.zip size=5059]http://www.chronoengine.com/images/fbfiles/files/com_cf_calendar_plugin.zip[/file]
wizdum 31 May, 2008
Hi Greyhead, sounds good.
When i try to install it says i need to enable legacy mode. Is this correct? Does legacy slow down the site or does it only effect extensions that need it?

Also, isn't there a way to use a calendar included with joomla 1.5?

edit: got it working manually
<td colspan='2'>
<?php JHTML::_('behavior.calendar'); ?> 
<script type="text/javascript" src="includes/js/joomla.javascript.js">
</script> 
<input class="inputbox" type="text" name="DOB" id='DOB' 
size="25" maxlength="10" value="" /> 
 <a href="#" onclick="return showCalendar('DOB', 
'dd-mm-y');">Show Calendar</a>     
    </td>
GreyHead 31 May, 2008
Hi wizdum,

I'll check the legacy code question. I'd forgotten that I have it on. I tried to write an installer that will work with both versions of Joomla - not sure if that can be done without triggering the legacy message . . .

Your manual code does pretty much the same as the PlugIn though I didn't know about behaviour.calendar so yours is simpler (my version uses three more script loads). I'll go and try it out . . .

Bob
Horst 02 Jun, 2008
Hi to everyone,

I tried wizdum's solution with no luck...

Heres my code:

<td colspan="4" nowrap="nowrap">
<?php JHTML::_('behavior.calendar'); ?>  
<script type="text/javascript" src="includes/js/joomla.javascript.js">
</script>
<input class="inputbox" name="arrivalDate" type="text" 
id="arrivalDate" size="18" maxlength="10" value="" /> 
<a href="#" onclick="return showCalendar('arrivalDate', 
  'dd-mm-y');">Zeige Kalendar</a>
      </td>
But after date selection my input arrivalDate says: dd-mm-y (the format string) but not the selected date.

What's wrong here?
Do I have to put my form code into "Form JavaScript:" rather
than "Form HTML:"?? (Because it contains JS)?

Regards,
Horst
wizdum 02 Jun, 2008
Yeah it looks like I was a bit hasty in claiming success. I get the same output as Horst.
Its probably the wrong thread to discuss this as the subject is GreyHead's plugin.

Heres what i found out:- see this thread

Horst: try '%d-%m-%Y'
shemzone 05 Jun, 2008
Hi GreyHead,
any chance to have this plugin for joomla! 1.0.15?
By the way, great job you have done with Chronoforms!
Regards
Fred
GreyHead 06 Jun, 2008
Hi Fred,

Yes, I'll take a look, I think that there are only some minor changes to have this work for Joomla 1.0.x but I also want to build in some of the info that wizdum found.

Bob
kai920 03 Jul, 2008
I used the following PHP code:

<?php 
		$date3 = JHTML::calendar( date("j M Y"), "Modified", "Modified", "%d %B %Y", "readonly=\"readonly\" size=\"16\"" );
        echo $date3;
        ?>


This generates what seems to be the correct HTML inside the form:

<input type="text" size="16" readonly="readonly" value="3 Jul 2008" id="Modified" name="Modified"/>


However, there is no data being saved into the table even after adding a hidden input field ("<input name='Modified' type='hidden' />")

Would I have better luck with this plugin?
shemzone 04 Jul, 2008
Hi kai920,
I have a couple of fields being readonly or hidden. No problem with that.
i.e:
<input name="OrderDate" id="OrderDate" type="text" size="30" readonly="true" value="<?php echo strftime('%d/%m/%Y') ?>"/>

or
<input name="SubjectEmail" type="hidden" value="Demande de devis" />

From your form setting (within Chrono Forms - Form Manager > Your form name) , check the "Auto generated" tab. In the code, you should see something like:
'".mosGetParam($_POST,'Modified','')."' , 


If not, add it and it should be recorded.

Hope this helps.
Regards
kai920 17 Jul, 2008
shemzone wrote:
'".mosGetParam($_POST,'Modified','')."' , 


[/quote]

Hi Shemzone, thanks for your reply. I checked my two calendar fields which are submitting blank and they do indeed have the auto generated code:

'".JRequest::getVar('Published','', 'post', 'string', '' )."' , '".JRequest::getVar('Modified','', 'post', 'string', '' )."' ,

My other date field's data is caught by chronoforms properly (this field does not have a popup calendar)
akari 04 Sep, 2008
is there a way to only show the calender, 12 months, 3 months on a row
randy270 09 Oct, 2008
This plugin is just not working for me. Installs fine. Enabled legacy mode. Pasted in php code where I want the calendar to appear. Enable plug-in. But all I get is the form itself, no calendar, and none of the other HTML loads. Just a bare page with an un-styled form.

Do I click the Calendar Plugin checkbox in the Plugins section?

Do I disable legacy mode?
GreyHead 09 Oct, 2008
Hi randy,

Don't use the plugin with the latest releases of ChronoForms. Max has built the functionality into the core code.

If you are still using an old version and can't upgrade then I can give you some code that should work more simply tharn the plugin.

Bob
randy270 10 Oct, 2008
This morning, I uninistalled ChronoForms 2.6 and installed 3.0. Everything looks fine. How do I install the popup calendars?
GreyHead 10 Oct, 2008
Hi randy,

Use the form wizard to create a new form and drag in the 'Date/Time Picker'.

I think you can cut and paste the corresponding code from the form html if you want to add it to an existing form.

Bob
moreiter 10 Oct, 2008
Hi,
I installed CF V3.0 Stable with Joomla 1.5.
I set up a form with the wizard ... there is no tab with calendar plugin ... there is no button besides the input box in the frontend.
I couldn't find any calender...file in the plugin folder ...

What am I doing wrong?

many thx.m.
GreyHead 10 Oct, 2008
see here . . .

[attachment=0]10-10-2008 18-32-08.png[/attachment]

Bob
moreiter 10 Oct, 2008
ok. thx. that is working.
but I don't see any calender button in the form in the browser ... just the input field.
if i click it nothing happensface-meh-blank

thx.m.
GreyHead 10 Oct, 2008
Hi moreiter,

Works OK here - maybe you have a JavaScript conflict?

Bob

[attachment=0]10-10-2008 18-58-03.png[/attachment]
randy270 10 Oct, 2008
I'm having the exact same problem, but not being much of a coder, I don't know where to even begin to look. This particular Joomla site has very few additional extensions installed. I'm using the ja-purity template. Could this be at issue? Any suggestions on where to start looking?
GreyHead 10 Oct, 2008
Hi randy270,

My example form works Ok in ja-purity too.

Try looking at the site with FireBug and see if any errors show up when you click the calendar field.

Or you can switch to the default Joomla calendar field which isn't quite so pretty but works OK.

Bob
randy270 10 Oct, 2008
It doesn't seem like the CSS file is loading. Could that have something to do with it? I mean, when I open the source, I don't see any link to the ChronoForms css files such as style1.css or calendar.css.

I have the Load Chronoforms CSS/JS Files? option set to Yes.
Max_admin 10 Oct, 2008
Hi randy,

if no CSS is there then there will be no JS too and no calendar will popup! do you have a link for me to look at ?

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
moreiter 12 Oct, 2008
Many thanks for your hits.
The simple solution: set the list "Load Chronoforms CSS/JS Files?" to YES ... 😶
greez.m.
randy270 13 Oct, 2008
Max,

Can I send you the link privately? The site is on my work machine and I'd rather not broadcast the address.
GreyHead 13 Oct, 2008
Hi randy270,

You can use the site contact form to contact Max or the email or PM buttons under his avatar.

Bob
randy270 13 Oct, 2008
Sirs, I offer my humble apologies. It seems I neglected to install the new Mambot for V.3! Once I did that, the calendar appears. Very, very nice.

I also noticed that once you do install this Mambot, it prevents Joomla's default calendar system from appearing, at least in my forms. No problem.

Many thanks, and again, my apologies.
This topic is locked and no more replies can be posted.