Hi,
In the date field, for the calender I want to make the weekends as disbaled (non selectable) whereas the week days should be selectable. is it possible to do this in a!datefield?
Discussion posts and replies are publicly visible
Nope. It is not possible. But a good work around will be to show instructions below the field and add a validation.
To validate should we use calisworkday function?
Yes you can.
Just know that calisworkday does not include week days marked as holidays.
Otherwise, another easy way to do this is to use the text() function and check for MON/TUE/WED/THU/FRI.
I have a field in the interface in which I select the dates using the a!datefield. In that case, I am not use how can we use the text(). When I use the below, I am getting an error, Expression evaluation error at function fn!calisworkday : A null parameter has been passed.
validations: if( fn!calisworkday(my field name) =true, true, "select a weekday"
You need to add a null check
a!localVariables( local!date, a!dateField( label: "Date", value: local!date, saveInto: local!date, validations: if( and( a!isNotNullOrEmpty(local!date), not(calisworkday(local!date)) ), "You have to select a weekday", "" ) ) )
Thanks for your help, it worked
I am using the validations as a reusable component, so created an interface like below.Created rule input of type date.
if( and( a!isNotNullOrEmpty(ri!fieldName), calisworkday(ri!fieldName) ), "", "Please Select a Weekday")
but the interface is throwing the error.
However it's working fine in the main interface where it's being called. I am not sure why I am getting this error. Can you please help me here
You should create your validation rule as an expression and not an interface.
Thanks, it worked