2 Fetaures needed

Hello,

inspired by another JS-Calendar, I miss 2 features with Scal.
Hope, there is a way to implement those 2 functions:

1. Closing calendar automaticly by choosing a date.
2. Possibility to make dates before X unchoosable and after Y unchoosable.
Example: If a variable 2008-03-10 is set, all dates before are not chooseable.
If a variable 2008-03-17 is set, all dates after are not chooseable.

Is this possible?

Thank you

Daniel

sorry but how to modify with

sorry but how to modify with this 2 features the floating scal ?

oncalchange

IanTyndall's picture

If you are using the version from our SVN, this function has been replaced with:
beforecalchange
aftercalchange

In your case, the best use would be beforecalchange... but again this is dependent upon the version of scal you are using.
Can you verify the version, or location where you downloaded it?

toggling the calendar and date ranges

jamiegrove's picture

Hi, Daniel.

Both of your elements are doable with the oncalchange function...

#1 You can just call toggleCalendar() in your oncalchange function.

var Cal = new scal('samplecal',updateelement, {
oncalchange: function(d) {
this.toggleCalendar();
}
});

#2 could be implemented in the same way as #1. Just check the d value against the date range you want to limit. Pop an alert if they select "bad" dates set the clicked date back to some other day.

A demo for oncalchange is in the docs...

http://scal.fieldguidetoprogrammers.com/scal-v02-documentation/scal-onca...

- Jamie

RE: toggling the calendar and date ranges

Hello Jamie,

thank you much for your quick reply.
I have do what you sugguest with the oncalchange function like below:

var fromcal = new scal(
'fromcal',
'datefrom_value',
{
oncalchange: function(d){
alert('TEST');
},
updateformat: 'dd.mm.yyy',
titleformat: 'mmmm yyyy',
daypadding: false,
weekdaystart: 1,
exactweeks: false,
planner: false,
tabular: false
}

);"

But nothing happens. If I change a date at the calendar, no alert will be shown up.
To clearify how i call the calender, I have to say, that the site with the calender will be loaded using AJAX-technology. I use the prototype library intensively. Therefore I searched for a calendar module wich is prototype-driven.

Could it be that the function not will be executed because I load that site with AJAX?

Sincerly

Daniel

svn version or zip version?

jamiegrove's picture

Hi, Daniel.

As Ian notes, there is a difference between the ZIP download and the latest version of scal available via SVN. Which are you using?

- J

RE: svn version or zip version?

Hi Jamie,

i use the ZIP-Version.
Should I test the SVN-Version?

Sincerly

Daniel

svn or zip

IanTyndall's picture

oncalchange should work with the zip, can you provide a minimal functional test that exhibits this problem?

You can try out the SVN trunk, but I'd still love for you to provide me a link to a functioning test case.

FIXED

Hi Ian,
Hi Jamie,

I have looked around scal.js and saw, that there cannot be provided a funktion like I need.
Therefore I have changed the source of scal.js to fit my needs.
You can see the effect at http://www.webres.org/0.90/test2.php

I have explained my work and it seems that it works fine.
If it is possible, you can take over my mod to the next svn. If I have done something forbidden, please tell me so I can remove the test-site and my modification from the sourcecode I actually use.

Sincerly and thank you for your very great help

Daniel

RE: svn or zip

Hi Ian,

first let me say a big thank you for the great support here.
Is there a way to donate your work via PayPal or something else?

I have prepared a test site for you in wich you can see how i implement and call the calendar.
There are also a few words about the way I init the calendar and what I need exactly.
I have loaded the svn version of scal and aftercalchange will be executed.
BUT ... and this is what is a little bit differnt. The aftercalchange function is also executed if I click on the month-forward, month-backward or month name itself.
What i need is that the calendar closes automaticly after choosing a date.
You can have a try at my site. Please click on a date ... the calendar still leaves visible. But if you click on the month name, it goes to invisible. I need exact the opposite of this functionality.
Is this realizable in any way?

http://www.webres.org/0.90/test.php

Sincerly

Daniel

Close on date select

IanTyndall's picture

Wow, I was way off... closing the calendar on date selection is easy.

Currently yours is:

var calFrom = new scal('fromcal', datefrom_value, options);

Replace the second param (datefrom_value) with a function name, ie: updatefrom.

The updatefrom:

function updatefrom(d){
$('datefrom_value').update(d.format('mmmm dd, yyyy'));
calFrom.toggleCalendar();
}

BTW: There is a donate link here: http://scal.fieldguidetoprogrammers.com

RE: Close on date select

Hi Ian,

I would like to tell you that this is also a way to get the proper result.
I think yours is many harder to implement for those wich have not much clue about what they do :-)
An easyer was to toggle calendar after clicking a date is to extend the options list like described on my test-site http://www.webres.org/0.90/test2.php

I will be happy if you can have an eye on this and give me a feedback for my work. Perhaps, the mod will find a way in any of your next svns ?

Its very nice for me to work with such engaged programmers like you.

Daniel

RE: RE: Close on date select

IanTyndall's picture

There are numerous types of functionalities that could be put in to use upon selecting the date such as (but not limited to):
- restricting date range
- close calendar
- update select element
- getting information on planner events

We did not see the need to account for all of the possibilities, so we left that up to the end developer.
My proposed suggestion was just a few lines of code, nothing complex.

We have one of the lightest weight calendars, and we are able to keep it this way b/c we leave the specifics up to the end developer.

I do appreciate your suggestion, any others you may have.

2 Fetaures needed

Hello,

inspired by another JS-Calendar, I miss 2 features with Scal.
Hope, there is a way to implement those 2 functions:

1. Closing calendar automaticly by choosing a date.
2. Possibility to make dates before X unchoosable and after Y unchoosable.
Example: If a variable 2008-03-10 is set, all dates before are not chooseable.
If a variable 2008-03-17 is set, all dates after are not chooseable.

Is this possible?

Thank you

Daniel

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options