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.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);
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.
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.
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.