This method sets the allowed days of the week, that can be entered into the Date control. To restrict the manual user input, create a custom validation plugin for the Edit as: Date fields.
Alternatively, you can set up the allowed weekdays and the validation with the Edit as: Date options.
Note: the "allowed" status and the message for each day are stored separately, so you can use this method several times to define individual messages for each set of days.
ctrl.toggleWeekDay( day, enable: boolean, message: string )
a number or an array of numbers, where 0 - is a Sunday, 1 - is a Monday, etc.;
a boolean variable, enables or disables the allowed days of the week;
an error message that is displayed when a date outside of the selected interval is selected. If no message is specified, a default one is displayed.
No return value.
Restrict selecting Friday and Sunday/Monday/Tuesday with 2 different messages:
var ctrl = Runner.getControl(pageid, 'datefield');
//restrict selecting Friday, show error message 1 when selected
ctrl.toggleWeekDay( 5, false, 'error message 1' );
//restrict selecting Sunday, Monday, Tuesday, show error message 2 when selected
ctrl.toggleWeekDay( [0,1,2], false, 'error message 2');
Note: replace "datefield" and each of the "error message" with the actual field name and error message in the function.
•"Edit as" settings: Validation types
•"Edit as" settings: Date
•"Edit as" settings
•Date control API