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

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

Participant ,
Feb 14, 2024 Feb 14, 2024

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
973
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
1 ACCEPTED SOLUTION
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;

View solution in original post

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

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

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

Apologies now attached

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 ,
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;

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

Many thanks Nesa, working great now.

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