Select to view content in your preferred language

Survey123 Connect - Make field read only - If value is entered in another field

127
3
Jump to solution
a week ago
ChristopherMask
Regular Contributor

Hello Community,

I wondered if there is a possibility to make a field readonly if there is a value entered into another field? 

field decimal ${CT_SPI40} if user enters a value, make field decimal ${CT_SPI20} readonly.

Any assistance would be appreciated.

Best,

Christopher

 

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

Yes you can put a formula in the read only column skipping the drop down.  It will complain at you at first but it does work.

Something like

${CT_SPI40} != ''

or sometimes you have to to string-length(${CT_SPI40}) > 0   

(Yes I know its a decimal field but 123 starts with everything as a string so this actually works.)

View solution in original post

0 Kudos
3 Replies
Ruth_JiatengXu
Esri Regular Contributor

Hi @ChristopherMask ,

Thanks for sharing here. I think there is a workaround method:

1. Set "body::esri:visible" for ${CT_SPI20} to make it only visible when ${CT_SPI40} is null

2. Add another note question which equals ${CT_SPI20} and make it only visible when ${CT_SPI40} is not null

Thanks,

Ruth

DougBrowning
MVP Esteemed Contributor

Yes you can put a formula in the read only column skipping the drop down.  It will complain at you at first but it does work.

Something like

${CT_SPI40} != ''

or sometimes you have to to string-length(${CT_SPI40}) > 0   

(Yes I know its a decimal field but 123 starts with everything as a string so this actually works.)

0 Kudos
ChristopherMask
Regular Contributor

Ended up using 

string-length(${CT_SPI40}) > 0 

for the readonly field ${CT_SPI20} 

Also, added this constraint in both fields 

(not(${CT_SPI20}) or ${CT_SPI20} = 0) for field ${CT_SPI40}

(not(${CT_SPI40}) or ${CT_SPI40} = 0) for field ${CT_SPI20}  

which I hope is correct and doesn't bite me in the end!

Thanks to you both for your response, which saved me from a headache. Have an excellent day!

 

Sincerely,

Christopher