RichWidgets\Input_Calendar disable all sundays ...

RichWidgets\Input_Calendar disable all sundays ...

Anybody an idea how to disable let's say all sundays in the input widget 
I've seen the parameter SpecialDays , however it only takes a list of dates.

I see in the documentation of the calendarwidget ( ) that there is a way to disable weekdays.
Is this implemented somehow ?
Just to come back to this one ....

Is there a way to disable all sundays ?
I see in the JS file that there is a disableHandler, but is it implemented in any way ?

@OutSystems : when do we get an updated version ... ?
The latest version of DHTML Calendar is 2-1.9 , current is 1.5
Hi Joop,

I've taken a quick look at the Rich Widgets, and this is what I've found:
You can use the SpecialDays parameter and specify dates using the format "1 :  [1,2]; 12 : [25]"

This means that the January 1st and 2nd, and December 25th html elements in the calendar, will have a class "special".

If you go to the Rich Widgets eSpace and the the Input_Calendar screen's css, you can find the styles that affect the special elements.

Bare with me, before we go to your question...
How does this work?

When building the calendar (running the actual javascript), you can specify certain parameters.
The parameters are specified here.

One of the parameters is the dateStatusFunc which allows you to specify an handler function. This handle function can return 3 things:
  • true : make the date disabled
  • false : make the date selectable
  • "class" : the element in the html will have that class
And you can read more about it here.
If you open one of the unescaped expressions at the Input_Calendar screen, you can see that the calendar uses a similar handler to the one described in the example.

This means than in order for you to disable all sundays in the calendar, you need to change the handler function to always return false when the date is friday.

In fact, the link that you just pointed out already tells how to implement such an handler:

function(date) {
        if (date.getDay() == 5) {
            return true;
        } else {
            return false;
Hope that this helps you getting started.
Joao Fernandes wrote:
Hi Joop,

I've taken a quick look at the Rich Widgets, and this is what I've found:
You can use the SpecialDays parameter and specify dates using the format "1 :  [1,2]; 12 : [25]"


Hope that this helps you getting started.
@Joao: Brilliant ! the quick work you did :-)
I'd already discovered that feature ... looking at the documentation link you send, I think I need this to be able to do the things I want ....

It all comes back to a bit of DIY :-) but would have been nice if the RichWidget has it already in it !
Got it working ... added a variable to set the dayNumbers to enable, added a special stye and here it is ...
Used the disableFunc 

Good work Joop.
I'm currious to know how you fully implemented it.

Can you please share with us? I bet there are other people that want to know how to do this.

And yes, I agree that the the Input_Calendar should make it easier to do this. This probably is a frequent use case...

I'm glad I could help!
1. I made a copy of the RichWidget into own eSpace

2. Added an extra input parameter DaysToDisallow which will hold the dayNumbers to disable as a comma seperated string

3. In the javascript on screen added after the SPECIAL_DAYS, misusing a jQuery function inArray to check in array ... :-)

     var SPECIAL_DAYS = {" + SpecialDays + " };
     function dateIsSpecial(year, month, day) {
        var m = SPECIAL_DAYS[month + 1];
        if (!m)
            return false;
        for (var i in m)
            if (m[i] == day) 
                return true;
        return false;

    var DISALLOW_DAYS = [" + DaysToDisallow + "];
    function disallowDate(date) {
        // date is a JS Date object
        if (  osjs.inArray(date.getDay(), DISALLOW_DAYS) > -1 ) {
            return true;
        } else {
            return false;
4. And in the setup part added :
If(SpecialDays <> "",
        "dateStatusFunc :   function(date, y, m, d)
                                if (dateIsSpecial(y, m, d))
                                    return ""special"";
                                    return false;
                            }, ",
        "") + 

    If(DaysToDisallow <> "",
        "disableFunc :   function(date, y, m, d)
                                if (disallowDate(date))
                                    return true;
                                    return false;
                            }, ",
        "") + "

5. In the CSS added this little line to overwrite the RichWidget CSS (because that one gets loaded later)
div.calendar tbody .disabled {
    color: #A0A0A0 !important; /* overwrite richWidget CSS */
    text-decoration: line-through;

Et voila, works like a charm !!

Nice work Joop..
And thank you for sharing this with the community..
It's a cool add-on feature for the Richwidget's input calendar component..

Hi Joop.

Can you attach your OML file for the input calendar component? 

Sorry Carl,
It's in a project ... :-) you'll have to copy/paste yourself !
João Fernandes,

You have mentioned . "1 :  [1,2]; 12 : [25]" Can I know how will the format be with the year . I tried with "2015:[1 :  [1,2]; 12 : [25]]"  but it doesnot work. I am using the Calendar control widget and that widget should have days enabled that are stored in an entity. I am  using an action and it has been working well for last year 2015 which use to have the variable in the format "1 :  [1,2]; 12 : [25]" the problem now is even for 2016 it is selecting last years dates.

Can any body please tell me how to add year in to the format "1 :  [1,2]; 12 : [25]"