Copy link to clipboard
Copied
Hello!
I am trying to make it so Monthly/Annually both update based on the value that is entered or updated.
Is it possible to get each of these 2 fields to update once either is filled in or when the value of either is changed?
It seems i can get one field to calculate based on the other but not vice versa .
event.value = Number(this.getField("txt_Annually").value) / 12; in Monthly field
event.value = Number(this.getField("txt_Monthly").value) * 12; in Annually field
I currently have these 2 calculations in each respective field. At the moment it doesnt allow you to alter the value inside the Monthly field.
Any advice would be greatly appreciated!
You can try it like this:
//Place this code as custom calculation script of Monthly field
if (event.source && event.source.name =="txt_Annually") {event.value = Number(this.getField("txt_Annually").value/12);}
else event.value = event.target.value;
//and place this code as custom calc script of the Annually field
if (event.source && event.source.name =="txt_Monthly") {event.value = Number(this.getField("txt_Monthly").value*12);}
else event.value = event.target.value;
Note: Credit to Try67 wh
...Copy link to clipboard
Copied
You can try it like this:
//Place this code as custom calculation script of Monthly field
if (event.source && event.source.name =="txt_Annually") {event.value = Number(this.getField("txt_Annually").value/12);}
else event.value = event.target.value;
//and place this code as custom calc script of the Annually field
if (event.source && event.source.name =="txt_Monthly") {event.value = Number(this.getField("txt_Monthly").value*12);}
else event.value = event.target.value;
Note: Credit to Try67 who coached me on how to apply (event.source && event.source.name) a while ago.
This will allow both fields to calculate based on each other's values and remain editable.
Copy link to clipboard
Copied
Thank you! Thought it might be something like this.
Copy link to clipboard
Copied
You're welcome.