grey out 7 days from current day in calender

HSN 09 Apr, 2009
Ok,

to some this will not make sense whilst to others I reckon it will make perfect sense.

Because of the way the date field is being used (for potential interested clients to choose their preferred date for an appointment) it would be handy to prevent them from choosing a date within the 7 days immediately after the current (date of completing the form).
Obviously the theory behind this one then is that they could choose whatever date they wanted as they would be prevented from choosing the current date and the next 7 following (eg today is the 9th so the earliest they could choose would be the 17th).

Something that would be a heck of a lot harder, but would make the system even better, would be to prevent the person who is completing the form, from choosing a weekend date (so a saturday or sunday).

What does everyone think to this idea, and further more, Max do you think this is something you could write in as options so it could be turned on and off etc? (maybe as property options).

Regards,

Tom.
GreyHead 09 Apr, 2009
Hi Tom,

Which calendar are you using? The standard Joomla one (the Dynarch DHTML Calendar by Mihai Bazon) - or the alternative that Max includes with ChronoForms (Calendar Emoxion by Mauel Garcia)? I'm sure that the Joomal one can be configured to do this - don't know about Max's and I can no longer find any good docs for it.

Bob

Later : correction - that Calendar Emoxion is still in the ChronoForms package but isn't in use - see Max's later post in this thread.
HSN 09 Apr, 2009
Hi Bob,

I meant the calender as part of chronoforms when building a form. Im no diva in php development, but I would hazard a guess at it needing a fair amount of work to get working if it was at all possible.

I just thought it would be an awesome functionality to have as part of the calender option as typically the calender would be used for things such as making appointments, preferred delivery dates and so on.

Regards,

Tom.
Max_admin 10 Apr, 2009
Hi Tom,

here ist he calendar script used and I "think" it may has something like this, check it and let me know

http://www.electricprism.com/aeron/calendar/

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 10 Apr, 2009
Hi Tom,

Needs a little workaround.

Create your form as usual, then go to the Autogenerated tab and look for the date_time field box - the name/id of your calendar field should be there, make a note of the value then delete the entry. (This is to stop ChronoForms doing the default calendar setup for you.)

In your Form HTML add the following code (the filed name here is date_0):
<?php
$doc = & JFactory::getDocument();
$script = "
window .addEvent('domready', function() {
  myCal_date_0 = new Calendar({ 
    date_0: 'd/m/Y'
  }, { 
    classes: ['dashboard'],
    blocked: ['0 * * 0,6'],
    direction: 7
  });
});
";
$doc->addScriptDeclaration($script);
?>

and Hey Presto! you have a calendar starting seven days from now with the weekends blocked.
[attachment=0]10-04-2009 15-53-23.png[/attachment]
The new bits are the the two lines blocked: ['0 * * 0,6'] which blocks weekends and direction: 7 which askes for a calendar starting in seven days time. See the docs that Max linked to for more options.

Bob
HSN 10 Apr, 2009
Hi Max and Bob,

Many thanks for this, I will have to take a look shortly to see if I can get it to work😀 . See I knew that a couple of great minds would think of a way🙂.

Bob, could I do this with an existing form already ?, this would save me from starting right at the beginning, thats all.

Regards,

Tom.
GreyHead 10 Apr, 2009
Hi Tom,

Yes, you can do it with an existing form, just add the code (with the correct id) at the beginning or end of your form html and remove the coresponding id from the date-time list on the Autogenerated tab.

Bob
HSN 10 Apr, 2009
Hi Bob,

I think im a little lost when you say AutoGenerated Tab and what im actually looking for.

Going into edit the form there is a tab called "AutoGenerated Code" , is this the tab you meant? If so what bits do I need to take note of ?

If you meant the html code for the actual form I currently have
<div class="form_item">
  <div class="form_element cf_datetimepicker">
    <label class="cf_label">Preffered Appointment Date *</label>
    <input class="cf_datetime required" maxlength="-1" size="20" id="prefApptDate" name="prefApptDate" type="text" />
    <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Preffered Appointment Date * :: Please let us know what date would be more suitable for you as an appointment. Please remember that an appointment should ideally be no sooner than 7 days away.</div>
  </div>
  <div class="clear"> </div>
</div>


Sorry still learning, although I learn fast🙂

Regards,

Tom.
GreyHead 10 Apr, 2009
Hi Tom,

Sorry, writing from memory in a rush . . .

It's the Autogenerated Code tab and the Date Fields names box (Note: I've closed the main box in the image)

Bob
HSN 10 Apr, 2009
Hi Bob,

Ok I took a note of the name there which changed from myCal_date_0 to myCal_prefApptDate . I then deleted the entry and moved tot he Form Html section (under a different tab).

Not sure if I placed the code wrong but when I pasted it in there (after the div for the calender) I only got the field showing on the form instead of the actual calender on the side also.

I know im going wrong somewhere lol. Btw many thanks for your help so far.
GreyHead 10 Apr, 2009
Hi Tom,

You need to change this line I think date_0: 'd/m/Y'

Bob
HSN 10 Apr, 2009
Hi Bob,

yup, that was me being completely stupid and dumb so shal go and hide in shame 😶

But yer its working now and it works a treat. What makes it even better is that a date cannot be manually typed into the field and so the calender is forced🙂

Regards,

Tom.
fshock 29 Sep, 2009

Hi Tom,

Sorry, writing from memory in a rush . . .

It's the Autogenerated Code tab and the Date Fields names box (Note: I've closed the main box in the image)

Bob



Hi!

I installed a latest ChronoForms_V3.1_RC5.5, but I have not DateFields field on Autogenerated tab.
So if I use instruction above I have 2 calendars (1 is generated by Chronoforms, 2nd - generated by your above instructions)
Could you let me know what is wrong?

Alex
GreyHead 29 Sep, 2009
Hi Alex,

It's been moved, all the date stuff is now at the bottom of the General Tab.

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