Skip to main content
Participating Frequently
February 5, 2025
Answered

Why does an amount field clear out when another amount field value is entered?

  • February 5, 2025
  • 2 replies
  • 848 views

I have a form fillable PDF that has 5 amount fields a user needs to enter.  They are each formatted as dollar amounts.  I have a 6th amount field that is read only that calculates the sum of those 5 fields and is also formated as dollar amount.  An amount is entered in field 1.  When an amount is entered in field 2, the amount in field 1 goes away, and so on with the remaining fields.  

I have verified all fields numerous times.  There is no other validations or calcuations on any of these fields.  What am I missing?

Thanks!

Correct answer PDF Automation Station

Have you check the console for errors?  I see from a previous post you only have Standard.  To open the console in Standard create a button with the following Mouse Up action:

console.show();

2 replies

PDF Automation Station
Community Expert
Community Expert
February 5, 2025

Are there calculations in other fields besides the ones listed?

Participating Frequently
February 7, 2025

Yes there is.  It is a lot so I'll try to step it all out.  

 

Page 1 contains a drop down for additional fundings ("--", "1", "2", "3", "4").  If any number is selected, I spawn page 2.  

Action > On Blur > Run Javascript:

if(event.value != "--")
this.getTemplate("ExtraFunding").spawn(this.numPages,false,false);
else if(this.numPages>0)this.deletePages(1,this.numPages-1);

 

Then, based on the number of fundings selected, I populate blocks of text fields on Page 2.  

Validate > Run custom validation script:

if (event.value == "--") {
this.getField("FundingType2").value = ""
this.getField("FundingType3").value = ""
this.getField("FundingType4").value = ""
this.getField("FundingType5").value = ""
} if (event.value == "1") {
this.getField("FundingType2").value = "Funding Type 2:"
this.getField("FundingType3").value = ""
this.getField("FundingType4").value = ""
this.getField("FundingType5").value = ""
} if (event.value == "2") {
this.getField("FundingType2").value = "Funding Type 2:"
this.getField("FundingType3").value = "Funding Type 3:"
this.getField("FundingType4").value = ""
this.getField("FundingType5").value = ""
} if (event.value == "3") {
this.getField("FundingType2").value = "Funding Type 2:"
this.getField("FundingType3").value = "Funding Type 3:"
this.getField("FundingType4").value = "Funding Type 4:"
this.getField("FundingType5").value = ""
} if (event.value == "4") {
this.getField("FundingType2").value = "Funding Type 2:"
this.getField("FundingType3").value = "Funding Type 3:"
this.getField("FundingType4").value = "Funding Type 4:"
this.getField("FundingType5").value = "Funding Type 5:"
}

 

Using "FundingType2" field for example here, on Page 2 in this field I have another validation script to display a drop down called "FundingType2a"

if (event.value == "Funding Type 2:") {
this.getField("FundingType2a").display = display.visible;
}if (event.value == "") {
this.getField("FundingType2a").display = display.hidden;
}

 

On the dropdown field "FundingType2a" it defaults to "- Select -" but if any of the other options are selected, it opens up additional fields here and makes them visible.  This script contains sensitive information so I'll only put in the first dropdown option and replace sensitive data with 'XXXX'.  Note, my issue occurs regardless which option is selected.  It is only on a field formated for Amount ("Amount2"), the issue does not occur with any other field that needs to be filled in.

var dropdownValue = this.getField("FundingType2a").value;
switch(dropdownValue) {
case "XXXX":
this.getField("AmountType2").value = "XXXX"
this.getField("Amount2").display = display.visible;
this.getField("Credit12a").value = "XXXX"
this.getField("Credit22a").value = "XXXX"
this.getField("Credit22c").value = ""
this.getField("Credit32a").value = "XXXX"
this.getField("Credit42a").value = "XXXX"
this.getField("Credit42c").value = "XXXX"
this.getField("Credit52a").value = "XXXX"
this.getField("Credit52c").value = ""
this.getField("Credit52d").display = display.hidden;
this.getField("Notes2a").value = "XXXX"
this.getField("Notes2b").display = display.visible;
break;

This issue is with the "Amount" field in the additional fundings only.  The field settings are as follows:

General > Form Field: Hidden, not Read Only, not Required

Options > no boxes are checked

Actions > no actions are configured

Format > Number, Decimal Places: 2

Validate > none

Calculate > none

 

I've reviewed all other validations and calculations and these are the only ones associated with or mention "Amount2".  

Any help is greatly appreciated as I have never written JavaScript before.

 

 

 

PDF Automation Station
Community Expert
Community Expert
February 7, 2025

Have you check the console for errors?  I see from a previous post you only have Standard.  To open the console in Standard create a button with the following Mouse Up action:

console.show();

Nesa Nurani
Community Expert
Community Expert
February 5, 2025

Can you share your file?

Participating Frequently
February 7, 2025

Unfortunately I cannot due to sensitive information already on the document.

Nesa Nurani
Community Expert
Community Expert
February 7, 2025

In that case you can check 'All JavaScript' to see if there are any script that affect those fields.