Skip to main content
Participant
December 12, 2017
Answered

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

  • December 12, 2017
  • 1 reply
  • 1124 views

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 has been closed for replies.
Correct answer try67

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;

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 12, 2017

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;

Participant
December 12, 2017

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.