set question as read-only based on it's own answer

386
5
Jump to solution
02-12-2024 12:21 PM
CharlottePeters95540
New Contributor III

Hi,

Is it possible to make a question read-only once its own answer is 'yes'? I know it's possible based on a previous question's response, but I need the question to trigger read-only on itself. 

My form is set up to monitor wood attributes. The initial survey establishes the data baseline for the wood structure and individual wood pieces. After the initial survey, I will change the structure and individual wood attributes to read-only, except for the question asking if the wood has separated from the main structure. If the wood has not separated, then the question remains editable until next year. If the wood has separated, it will remain separated from then on and relevant questions for veg type, wildlife obs, and wracking will appear in the monitoring section of the form. Once wood has separated from the structure, I don't want staff to be able to change the answer to No in future surveys, so I want to make it read-only.

Putting the form expression in the question's read-only column creates a redundancy error. I don't know if the question's response can be evaluated when the survey is opened to automatically make the question read-only.

I've attached a scaled-down version of my survey. I'm using Survey123 Connect ver. 3.18.123 to create the survey.

Thanks.

0 Kudos
1 Solution

Accepted Solutions
abureaux
MVP Regular Contributor

You could probably get around the dependency cycle issue with some JS. However, JS cannot be used in public surveys as it would introduce a security risk. If that isn't a limitation in your case, then I'd explore that route.

However, I would first recommend looking for an alternative solution. For example, misclicks happen all the time, and locking this field permanently based on a misclick wouldn't be good.

View solution in original post

0 Kudos
5 Replies
abureaux
MVP Regular Contributor

This would create a dependency cycle, so no.

0 Kudos
abureaux
MVP Regular Contributor

Also, your Connect is out of date. You may wish to download the Windows Store version so it auto updates. This will avoid future issues.

0 Kudos
CharlottePeters95540
New Contributor III

@abureaux Thanks for the information. I'll try the Windows Store download.

If the read-only expression cannot be set on its own question, is there another way using additional fields or a script to make a question read-only based on its own answer?

 

0 Kudos
abureaux
MVP Regular Contributor

You could probably get around the dependency cycle issue with some JS. However, JS cannot be used in public surveys as it would introduce a security risk. If that isn't a limitation in your case, then I'd explore that route.

However, I would first recommend looking for an alternative solution. For example, misclicks happen all the time, and locking this field permanently based on a misclick wouldn't be good.

0 Kudos
CharlottePeters95540
New Contributor III

@abureaux Thanks for your input. The survey is not public. I think questions can be auto populated with responses on previous surveys, so I'll look into that more.  

0 Kudos