Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

How to disable weekday on designer form calendar?

Avatar

Level 2

Hi,

I am designing an interactive form with a date/time field calendar. I need to disable the weekday date from calendar, so the user can pick the weekend dates only.

I'm currently using the following code on 'exit' event of the calendar to alert if user chose weekday.

Is there any other way to disable weekdays on 'initialize' event of date/time field?

form1.#subform[0].DateTimeField1::click - (FormCalc, client)

  var weekday = Num2Date(Date2Num($, "YYYY-MM-DD"), "EEE");
    if (weekday <> "Sat" or weekday <> "Sun" )then
        $host.messageBox("Please enter a Sunday week ending date", "Invalid Date", 0, 0);
    endif

Thanks,

Roya

4 Replies

Avatar

Level 10

You cannot modify the calendar widget, it will always display all days of week.

But you can use scripting to select another weekday if the user selected saturday or sunday.

Put this script into the exit:Event of the date field.

It will correct the date to the previous fridy if the selected day is saturday or sunday.

Avatar

Level 2

Hi radzmar,

Thanks for your quick reply. Your code is working fine but it might confuse the user.

I understand that the calendar shows all days of week, I was hoping to find a code to disable or highlight some dates.

Regards,

Avatar

Level 10

You possibly can create your own date picker.

But this requieres a lot of scripting and may be not working with flowable layouts.

Anyway, here's a nice sample of a selfmade calendar.

http://cookbooks.adobe.com/post_An_alternative_Date_Picker_for_LiveCycle_Designer-18455.html

Avatar

Level 2

Thanks Raszmar, I would try the date picker sample.