I have 2 fields one called email and the other phone. I want to make it so that either one of them have to be filled in for the survey to be sent. How do I set the required and constraint fields? Any help is appreciated
Solved! Go to Solution.
For these it always ends up in a dependency cycle. So I use a 3rd field like this.
type | name | label | hint | constraint | constraint_message | required | required_message | appearance | default | readonly | relevant | calculation |
text | fieldA | fieldA | ||||||||||
text | fieldB | fieldB | ||||||||||
calculate | checkfields | checkfields | .!='' | Must fill out fieldA or B | coalesce(${fieldA}, ${fieldB}) |
Someone may have another idea. Hope it helps.
For these it always ends up in a dependency cycle. So I use a 3rd field like this.
type | name | label | hint | constraint | constraint_message | required | required_message | appearance | default | readonly | relevant | calculation |
text | fieldA | fieldA | ||||||||||
text | fieldB | fieldB | ||||||||||
calculate | checkfields | checkfields | .!='' | Must fill out fieldA or B | coalesce(${fieldA}, ${fieldB}) |
Someone may have another idea. Hope it helps.
Doug Brwoing with the WIN! Thank you that solved it!
How did you solve this. Which one is set to required?
Neither is set to required. You instead set the constraint on field 3 to !=''. This will fire if both are blank but not if either one has a value.
Has anyone tried this solution recently? I had built a survey in Survey123 Connect a few months back implementing this solution, but it does not appear to work anymore. I tried setting up similar constraints on multiple fields, but they survey goes through without any issues.
I like Doug's solution, but we solved this by creating a select one question (${contact}) that asks the user "how do you wish to be contacted" with (text message, email, phone) as options. Then you make the email and phone questions (both set to required) visible/hidden with a relevant expression. selected(${contact},'email') on the email question or selected(${contact},'phone') or selected(${contact},'text_message'). if the question is relevant, it will be required.
Sorry to stir up an old post but is there any way to do this with the current web creator or is this functionality reserved to Survey123 Connect?