Hi,
Is there a way to disable certain days from being picked.
I wish to use the calendar for a booking system where certain venues only offer particular days, for example, venue 1 might only be available on Tuesdays and Wednesday so I would want to prevent any other day from being selected by the user. Venue 2 might be available on Mondays and Wednesdays etc...
Thanks,
John
Hi @JayPea ,
Use Initialized event handler to disable the week days,
In the event handle call the DatePickerDisableWeekDays client action available in OutsystemsUI module and pass the required weekdays input parameter value to True .
or
You can use on change event handler of venue event for disabling required weekdays for the venue. Check the OML for reference
Thanks &Regards,
Surya
Another quick question @Suryanarayan Vundru
I'm retrieving a list of available days from a datafetch. On the datafetch 'onafterfetch' I am assigning the available days to the local variables called 'disableMondays', disableTuesdays' etc...
The problem is that the datepickerinitialize initializes before the local variables have updated. How would I fix this?
Thanks
Hello @JayPea,
Please check the following discussion. It might help you.
https://www.outsystems.com/forums/discussion/87400/outsystems-ui-disable-dates-on-date-picker-in-outsystems-ui-version-2-9-0/
https://www.outsystems.com/forums/discussion/92177/date-picker-disable-date-pick-by-user-and-holidays/
Thank you.
Use the date Picker and bind it to a local variable For.example: SelectedDate. When a user selects a venue, save the allowed weekdays in a local list For example [2, 3] for Tuesday and Wednesday.On date selection using OnChange or a button action, get the weekday number of SelectedDate using the Weekday() inbuilt function. Weekday() returns 1 for Sunday, 2 for Monday like that.Check if the weekday is in the allowed list.If yes means continue.If no means show a error or warning message and reset the date to null.
Sudha Narayanan
Thanks guys and thank you @Suryanarayan Vundru. I went for your solution in the end.
Hi @JayPea, You need to call this logic(disabling the required weekdays) on selection of venue or on change of venue. Hope you referred the oml attached.
It is not required to call the disable logic at Initialized event handler. Call the logic on change of venue
Thanks, when I land on the page the venue is already selected so I can't use the same approach as the dropdown on change but I guess I just need to instantiate the variables in the previous block so that they are correct when initiated or I can just add another button to enable the calendar or something.
If you know the Venue before landing the page you can initialize the variables on on initialize, or if you setting the variable onafterfetch call the disable logic on onafterfetch action.