I have a two page Acroform with a button which runs script to add a continuation page from a template. The page adds just fine.
The problem is that in my JS, I try to setFocus to the textfield on the continuation page. But nothing happens. The page is added, but my view doesn't move. I don't think any field has focus. Here is my continuation button code from Page1:
// make sure a continuation page has not already been added.
if (this.getField("continuationAdded").value == "Off") {
var contPage = this.getTemplate("continueTemplate");
contPage.spawn( {
nPage:1,
bRename:false,
bOverlay:false
} );
// set checkbox so another continuation page can't be added.
this.getField("continuationAdded").value = "Yes";
// set the page numbers at the bottom of the pages. This is working, so I know
// I have gotten this far in my script.
this.getField("txtPg1PgTotal").value = "3";
this.getField("txtPg3PgNum").value = "3";
this.getField("txtPg3PgTotal").value = "3";
// setFocus to the textfield on Page2.
this.getField("db_contin").setFocus();
// In desperation also tried other names that might work.
// this.getField("db_contin1").setFocus();
// this.getField("db_contin#1").setFocus();
}
The text field on Page 2 (continuation page from template) is db_contin. When I look at the field name in the fields panel, it is listed as "db_contin#1". Since I don't understand why these numbers are being generated, I tried a few different names for the field to setFocus. No luck.
Anyone have an idea why I can't set Focus?
Thanks,
Devra
Have you tried just showing the template?
Use of the renaming option prevents duplication of form field names.
George Kaiser