Posting for the first time, but have been dependent on the info shared in this group since I have embarked on the Survey123 journey! Ismael Chivite and James Tedrick have been amazing at providing answers along with the community at large; definitely super grateful for that!
The issue that I need help with, is locking down the ability to enter a value in a field after the form has been submitted once. My form is used to collect information on damaged sites and allows users to enter a date in one of the fields for when an incident occurred.
For on going incidents, users can go back into the same form/record and update info as things progress. However, when the incident occurred will never change (i.e. if an incident occurred on 2018/11/01, regardless of how many times someone goes in to update information on that site, the date of the incident will always remain 2018/11/01 as that's when it happened). I would like to be able to essentially make the field value read-only after the first submission.
Is there currently a way to do this? I have used the once() function for other things but don't believe it is meant for this (and I definitely cannot self-reference the field in the calculation for that field). Any help would be appreciated!
The once() function is designed to ensure a calculation is only done once, so is appropriate for questions with calculations. Aside from that, you could use the new capability of readonly columns to use expressions to set a criteria for the question to be readonly - if there is a hidden status field, you could set certain questions to be read only when the status is closed.
Thanks James, appreciate the response! I was not aware of read-only columns supporting expressions. In light of that, is there a property that counts how many times a particular record has been submitted? i.e. if I submit a form for 'Site A' today and then it is re-submitted with updates to attributes 9 times after, is that count being captured? Can I create hidden field that could capture that? If so, I could use it in the read-only expression such that the Date of Incident field becomes read-only if this 'count' value is greater than 0.
I attempted my previous idea by using wrapping the end_date in a once function in a hidden field and then using an expression to set the Date of Incident to read-only if there was a value in the field capturing the end_time once. However, the end_time would populate as soon as the survey was opened, making the Date of Incident read-only from the start. Not sure if there is a glitch as end-time should only be calculated when the user submits a survey (at least that is my understanding of it).