Skip to main content
stevenc65695984
Participant
January 24, 2017
Question

show and hide fields based on another field value equal to or greater than

  • January 24, 2017
  • 1 reply
  • 6515 views

Good evening,

I want to show and hide a field based on another field's numerical value being equal to or greater than. The scenario is, if one field name "text1" (which has a calculation formula of its own) is equal to or greater than 50k, I want the form to show 7 other fields. If its less than 50k then I want those fields to be hidden. Therefore, those fields should be always hidden unless the value goes 50k+ in "text1". I have been looking around for a while been the syntax I keep getting doesnt seem quite right.

Thanks in advance!

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
January 24, 2017

At the end of your calculation script for "text1" add this code:

if (event.value>=50000) {

    this.getField("field1").display = display.visible;

    this.getField("field2").display = display.visible; // etc.

} else {

    this.getField("field1").display = display.hidden;

    this.getField("field2").display = display.hidden; // etc.

}

Edit: Added the "equals to" operator...

Participating Frequently
October 27, 2023

I used this and it works; however, when I tested as a person filling out my form and revised the amounts in the fields, the change did not get picked up to re-hide the field.

 

event.value=((this.getField("Text3").value));
if (event.value>0) {

this.getField("check5").display = display.visible;


} else {

this.getField("check5").display = display.hidden;


}

 

Participating Frequently
October 27, 2023