Skip to main content
Participant
Dec 12, 2017 5:36 PM UTC
Answered

Help with show/hide field based on range of values in other field

Hello!

I'd like to show or hide a few fields based on the answer given in a previous field.

For example if the number in "Total" is 0-9, then Field 1 will appear. If the number in "Total" is 10-19, then Field 2 will appear. If the number in "Total" is 20-29, then Field 3 will appear, etc.

I can't seem to find this situation in any previous posts.

Thanks in advance!

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Dec 12, 2017 7:15 PM UTC

It was discussed many times, but I'll help you sort it out.

As the custom validation script of your Total field enter something like this:

this.getField("Field 1").display = (event.value>=0 && event.value<=9) ? display.visible : display.hidden;

this.getField("Field 2").display = (event.value>=10 && event.value<=19) ? display.visible : display.hidden;

this.getField("Field 3").display = (event.value>=20 && event.value<=29) ? display.visible : display.hidden;

7 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Dec 12, 2017 7:15 PM UTC

It was discussed many times, but I'll help you sort it out.

As the custom validation script of your Total field enter something like this:

this.getField("Field 1").display = (event.value>=0 && event.value<=9) ? display.visible : display.hidden;

this.getField("Field 2").display = (event.value>=10 && event.value<=19) ? display.visible : display.hidden;

this.getField("Field 3").display = (event.value>=20 && event.value<=29) ? display.visible : display.hidden;

Translate
Participant
Dec 12, 2017 7:50 PM UTC

Hi there! Thanks for the help. Do I have to write it all separate as you have it or all in one? It doesn't seem to be working.

Translate