Skip to main content
Inspiring
December 23, 2021
Answered

Show/Hide text field based on a number in another field

  • December 23, 2021
  • 1 reply
  • 1811 views

I need to be able to show/hide Text and Checkbox fields based on the amount that is entered into a field. I also have another field that changes the text in the field based on what is entered into that amount field. I could also use that field to show/hide the boxes.

 

The amount is enter into the "SHARE_BALANCE" field. Then I have a text field called "Microfilm" that has this in the Custom Calculation Script:

var score = this.getField("SHARE_BALANCE").value;
if(score > 249.99) event.value = "Over $250 send to RSS & Microfilm";
else if (score < 250.00) event.value= "Under $250 send to Microfilm Only";

If the SHARE_BALANCE is >249.99 then I need to hide checkbox field "DL" and text field "Copy of DL". BUT if the balance is $250.00 or more then I need to show "DL" and "Copy of CL" fields.

 

This topic has been closed for replies.
Correct answer Nesa Nurani

You can use something like this as Validation script of SHARE_BALANCE field:

var a = this.getField("DL");
var b = this.getField("Copy of DL");
if(event.value <= 249.99){
a.display = display.hidden;
b.display = display.hidden;}
else {
a.display = display.visible;
b.display = display.visible;}

 

Did you mean if  SHARE_BALANCE is less then  249.99 to hide fields (> means higher)?

You write Copy of DL and Copy of CL is one of those mistake?

 

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
December 23, 2021

You can use something like this as Validation script of SHARE_BALANCE field:

var a = this.getField("DL");
var b = this.getField("Copy of DL");
if(event.value <= 249.99){
a.display = display.hidden;
b.display = display.hidden;}
else {
a.display = display.visible;
b.display = display.visible;}

 

Did you mean if  SHARE_BALANCE is less then  249.99 to hide fields (> means higher)?

You write Copy of DL and Copy of CL is one of those mistake?