Copy link to clipboard
Copied
box1 = 500
box2
box3 = box1- box2
I want the field value from box1 to display and active only when there is value in box2.
The script please For box1?
Try this:
event.value = this.getField("box2").value != "" ? 500 : "";
Copy link to clipboard
Copied
As validation script of box2 use this:
this.getField("box1").value = event.value != "" ? 500 : "";
Copy link to clipboard
Copied
I'm sorry since box2 already have another script when i try to add this script to the bottom of it, it is not working. The new script that i need has to be in box1
Copy link to clipboard
Copied
You have script in validation or calculation?
Copy link to clipboard
Copied
Script is in Custom calculation
Copy link to clipboard
Copied
As Nesa said use it in validation, read her post above please.
Copy link to clipboard
Copied
Try this:
event.value = this.getField("box2").value != "" ? 500 : "";
Copy link to clipboard
Copied
Works perfecly thanks a lot!!!!
Copy link to clipboard
Copied
Hi,
Can I clarify what you want to happen.
Starting point of document
[box1 hidden]
box2 has no value
box3 = ????
Then the user enters a value in box2
box1 = 500
box2 = 10
box3 = 490
So the key parts are what does box3 equal when box1 is hidden, as hidden just means the user can't see it?
Copy link to clipboard
Copied
I meant to say leave the field blank
Copy link to clipboard
Copied
Hi,
Then you probably want to place 2 small scripts, one to deal with the show hide and one to deal with the calculation.
In the validation of box2, you can place something like
// this shows and hides box1 based on box3 having a value.
if ( event.value !== "" ) {
this.getField("box1").display = display.visible;
} else {
this.getField("box1").display = display.hidden;
}
note: the above does not check it is a sensible value, just a value.
Then in the validation of box3 you can put something like:
var box2Value = this.getField("box2").value;
if (box2Value !== "" ){
event.value = 500 - box2Value;
} else {
event.value = "";
}
Copy link to clipboard
Copied
Script has to be in box1
Thanks!!!
Copy link to clipboard
Copied
Why?
Copy link to clipboard
Copied
Why??????