Make a date field 'read-only' after that the date as been entered
-
06-02-2021 - |
Question
I have a form for my custom SharePoint List that, and I need to make a date field 'read-only' after someone goes in and fills in the date.
What is the best way to do to this via InfoPath?
Solution
Use Formatting rule.
If the date field is not blank and it has valid value, disable this field control (make it read-only).
In the InfoPath form, the date value always in this format: yyyy-mm-ddThh:mm:ss
(e.g. 2019-03-05T00:00:00-07:00 or 2001-03-05T00:00:00)
Using the following pattern to check if the date value is valid:
((([0-9][0-9])|([1-2][0-9][0-9][0-9]))-(([1-9])|(0[1-9])|(1[0-2]))-(([0-9])|([0-2][0-9])|(3[0-1]))T00:00:00)|((([0-9][0-9])|([1-2][0-9][0-9][0-9]))-(([1-9])|(0[1-9])|(1[0-2]))-(([0-9])|([0-2][0-9])|(3[0-1]))T00:00:00-0([0-9]):00)
Use the rule:
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange