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

Does a field on a spawned page get seen by javascript?

Explorer ,
Feb 14, 2024 Feb 14, 2024

Copy link to clipboard

Copied

I am currently working on a form with 7 checkboxes. If "Trust" is clicked then it spawns a new page. If the others are clicked then I want the spawned page to delete. 

I have spawned a page with a text field called "Page text 2". I have added the following code to the other six checkbox buttons. 

 

var v = this.getField("Check Box 1").value; if (v === "Partnership") { var f = this.getField("Page text 2").page; this.deletePages(f); }

 

Obviously changing the Value for the other 5 checkboxes. 

 

It doesn't seem to be working. 

 

I will be grateful for any help. 

 

Steve

TOPICS
JavaScript , PDF , PDF forms

Views

369

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Feb 14, 2024 Feb 14, 2024

When you created template did you have two of those fields because it is considered as second field? It gets spawned with widget 1, so either update your template and use a new name or in your script add its widget to the field name like this: var f = this.getField("Page text 2.1").page;

Votes

Translate

Translate
Community Expert ,
Feb 14, 2024 Feb 14, 2024

Copy link to clipboard

Copied

There is no "Page text 2" field on spawned page.

Votes

Translate

Translate

Report

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
Explorer ,
Feb 14, 2024 Feb 14, 2024

Copy link to clipboard

Copied

Apologies now attached

Votes

Translate

Translate

Report

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 ,
Feb 14, 2024 Feb 14, 2024

Copy link to clipboard

Copied

When you created template did you have two of those fields because it is considered as second field? It gets spawned with widget 1, so either update your template and use a new name or in your script add its widget to the field name like this: var f = this.getField("Page text 2.1").page;

Votes

Translate

Translate

Report

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
Explorer ,
Feb 15, 2024 Feb 15, 2024

Copy link to clipboard

Copied

LATEST

Many thanks Nesa, working great now.

Votes

Translate

Translate

Report

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