Skip to main content
Inspiring
February 14, 2024
Answered

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

  • February 14, 2024
  • 1 reply
  • 1268 views

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

This topic has been closed for replies.
Correct answer Nesa Nurani

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;

1 reply

Nesa Nurani
Community Expert
Community Expert
February 14, 2024

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

Inspiring
February 14, 2024

Apologies now attached

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
February 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;