Hide Spawned Content after Showing with bOverlay

Contributor ,
Jan 10, 2020 Jan 10, 2020

Copy link to clipboard

Copied

Is it possible to hide content that was spawned from a page template using bOverlay?

I'm trying to create a single form that has similar content but will spawn new contend based on selection in a combo box. I'd rather use spawn and page templates as a lot of the background elements will change depending on selection.

Spawning works great, but I'm unsure if it's possible to remove a spawned template contents after spawning it. I could hide the fields but not the background page data. I think replacing bg data also would require advanced usage rights I don't want to mess with.

The other option would be to create background elements as read-only buttons and scrap the spawning idea, but it's not as clean as I'd like it to be. It's my number 1 fallback, however. I'd also rather not mess with the rect property. It annoys me.

Another idea I was toying with is if it were possible to create a template out of page 1 and spawn the template as default, then create a trigger from the combo box (if it's not set at the default selection) it would validate that, then spawn a new copy of page 1 then delete the original page 1.

Here's the code I tried that didn't work. I assume it's trying to hide the template page and not the template overlaid on the page, which is what I'm looking for.

var partsT = this.getTemplate("parts");
var eurgaT = this.getTemplate("eurga");
var repairT = this.getTemplate("repair");
var infieldT = this.getTemplate("in-field");
if(event.willCommit) {
	if(event.value == "Parts Request") {
		partsT.spawn(0, false, true);
		eurgaT.hidden = true;
		repairT.hidden = true;
		infieldT.hidden = true;
	}
	else if(event.value == "End User RGA") {
		partsT.hidden = true;
		eurgaT.spawn(0, false, true);
		repairT.hidden = true;
		infieldT.hidden = true;
	}
	else if(event.value == "Repair Request") {
		partsT.hidden = true;
		eurgaT.hidden = true;
		repairT.spawn(0, false, true);
		infieldT.hidden = true;
	}
	else if(event.value == "In-Field Service Request") {
		partsT.hidden = true;
		eurgaT.hidden = true;
		repairT.hidden = true;
		infieldT.spawn(0, false, true);
	}
	else if(event.value == "Select Form") {
		partsT.hidden = true;
		eurgaT.hidden = true;
		repairT.hidden = true;
		infieldT.hidden = true;
	}
}
TOPICS
Acrobat SDK and JavaScript, Create PDFs, PDF forms

Views

426

Likes

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

Contributor , Jan 10, 2020 Jan 10, 2020
I got it to work with the idea I had to create a temlate of page 0, spawn it to 1, then hide the original. I then created a keystroke script to check whether the default combo selection was triggered (combo set to select immediately) then spawn page 0 and overlay a template on top of that depending on selection, then delete page 1.var coverT = this.getTemplate ("cover"); var partsT = this.getTemplate("parts"); var eurgaT = this.getTemplate("eurga"); var repairT = this.getTemplate("repair"); var ...

Likes

Translate

Translate
Contributor ,
Jan 10, 2020 Jan 10, 2020

Copy link to clipboard

Copied

I got it to work with the idea I had to create a temlate of page 0, spawn it to 1, then hide the original. I then created a keystroke script to check whether the default combo selection was triggered (combo set to select immediately) then spawn page 0 and overlay a template on top of that depending on selection, then delete page 1.

var coverT = this.getTemplate ("cover");
var partsT = this.getTemplate("parts");
var eurgaT = this.getTemplate("eurga");
var repairT = this.getTemplate("repair");
var infieldT = this.getTemplate("in-field");
if(event.value != "Select Form") {
	if(event.willCommit) {
		if(event.value == "Parts Request") {
			coverT.spawn(0, false, false);
			partsT.spawn(0, false, true);
			this.deletePages(1);
		}
		else if(event.value == "End User RGA") {
			coverT.spawn(0, false, false);
			eurgaT.spawn(0, false, true);
			this.deletePages(1);
		}
		else if(event.value == "Repair Request") {
			coverT.spawn(0, false, false);
			repairT.spawn(0, false, true);
			this.deletePages(1);
		}
		else if(event.value == "In-Field Service Request") {
			coverT.spawn(0, false, false);
			infieldT.spawn(0, false, true);
			this.deletePages(1);
		}
	}
}
else {
	if(event.willCommit) {
		if(event.value == "Parts Request") {
			partsT.spawn(0, false, true);
		}
		else if(event.value == "End User RGA") {
			eurgaT.spawn(0, false, true);
		}
		else if(event.value == "Repair Request") {
			repairT.spawn(0, false, true);
		}
		else if(event.value == "In-Field Service Request") {
			infieldT.spawn(0, false, true);
		}
		else if(event.value == "Select Form") {
			coverT.spawn(0, false, false);
			this.deletePages(1);
		}
	}
}

Likes

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
Adobe Community Professional ,
Jan 10, 2020 Jan 10, 2020

Copy link to clipboard

Copied

LATEST

A spawned page cannot be hidden, but it can be deleted. Even with Acrobat Reader.

You can have an "always hidden" template that store data in fields that have the same name.

Likes

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