Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Trouble with Checkbox mouse-up script to spawn/delete pages

Contributor ,
Aug 04, 2023 Aug 04, 2023

I have a mouse-up javascript containing a doc-level function name, when selected spawns 5pp. When unselected the spawned pp don't delete. I've re-written the doc-level function script, assigned unique fields names across the 5 spawned pages, and re-created the templates, all following suggestions I found here in the Community. The Console also displays no errors. Here's the doc-level script I'm using.

function calcP19Marker()
{
var P19 = getSpawnedPageNumber(this, "P19Marker");
if (this.getField("CkBxNMVTIS").valueAsString=="Yes" ) {
if (P19==-1) {
this.calculate = false;
this.getTemplate("p19").spawn(this.numPages, false, false);
this.getTemplate("p20").spawn(this.numPages, false, false);
this.getTemplate("p21").spawn(this.numPages, false, false);
this.getTemplate("p22").spawn(this.numPages, false, false);
this.getTemplate("p23").spawn(this.numPages, false, false);
this.calculate = true;
}
} else if (P19!=-1) this.deletePages(P19, P19+4);
}
Field "P19Marker" is used to ID the Starting page. The remaining 4 pp also contain their own unique 'Marker' fields.
Any help as to why the pages spawn on checkbox selection but do not delete when unselected is greatly appreciated- thanks in advance!
TOPICS
JavaScript
391
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 04, 2023 Aug 04, 2023

Any error message in the Javascript console? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 04, 2023 Aug 04, 2023

none

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 04, 2023 Aug 04, 2023
LATEST

Yes I think so. This comes up when I select a checkbox to show a field with a custom calculation script.

 
if (this.getField("SellPrice").value!= "0.00") {
var owedTaxAmount = (this.getField("SellPrice").value - this.getField("TradeInValue").value)
var resCounty = (this.getField("CountyTaxRate").value);
 
if (owedTaxAmount < 5000.01) {
event.value = owedTaxAmount * (0.06 + resCounty);
} else if (owedTaxAmount > 5000) {
event.value = (((owedTaxAmount - 5000) * 0.06)) + (5000 * (0.06 + resCounty));
} else {
event.value = 0;
}
}

It executes fine though. But the message says "Unable to find format" at the bottom of the Console?  "CountyTaxRate", "SellPrice", and  "TradeInValue" are formatted for Number with decimal. "CountyTaxRate" has 3 decimals, and both "SellPrice", and  "TradeInValue" each have 2 decimal places. Both "SellPrice", and  "TradeInValue" also have default values of "0.00". How would this be affecting my other checkbox problem?? Thanks in advance for any guidance!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines