Hi,
How do I refresh a form..I tried xfa.form.remerge(); and xfa.layout.relayout(); but both of them dont work.
I want the form or letter to go back to its original state once the user click Print.
Thanks
Ace
Views
Replies
Total Likes
Hi Ace,
You need the reset script/button - just drag the standard one from the object library and copy/paste after the print command. This will delete all of the data that the user has entered, which may not be what you or the user wants. Maybe include a message and check the users response (Ok, Cancel).
xfa.host.resetData();
Note that the reset button will not restore repeatable objects back to their original number (min count or initial count). A form here does this manually in the reset button: https://acrobat.com/#d=RZ1lzX23*u7L4N9rtWCYPQ
Good luck,
Niall
Views
Replies
Total Likes
Thanks Niall,
The reset button only deletes the data entered by the user, doesnt refresh it to its original state
This is a letter, its flowed, it has no repeating objects.
On the header of the letter when the user prints, I "remove the combs" and also on the address fields if the user didnt fill in line 2 or line 4 for example, once the user clicks print I remove the empty lines...
So what I want is to "reset" this letter to its original state with the combs and all the address lines.
Views
Replies
Total Likes
Okay,
I think I have a better handle on it now.
For the address fields you could use a prePint script:
if (this.rawValue == "" || this.rawValue == null)
{
this.presence = "hidden";
}
And then on the postPrint event:
this.presence = "visible";
Not sure how you are removing the combs, but a similar prePrint/postPrint approach should work.
Niall
Views
Replies
Total Likes
This
is how I remove empty lines on the address, I call this method on the prePrint
function
removeEmptyLines(elementName, elementValue){
if (elementValue == " " || elementValue == "" || elementValue == null){
xfa.resolveNode(elementName).presence
= 'hidden';
}
else{
xfa.resolveNode(elementName).border.edge.color.value
= "255,255,255";
}
For removing the combs I call this method ( I dont really remove them...but assign what is entered on the combs to another fiield_print without the combs)
function
removeComb(elementName, elementValue){
xfa.resolveNode(elementName
+ "_print").rawValue = elementValue;
xfa.resolveNode(elementName).presence
= 'hidden';
xfa.resolveNode(elementName
+ "_print").presence = 'visible';
}
Views
Replies
Total Likes
Hi Ace,
You could just call another function on postPrint:
restoreEmptyLines(elementName){
var vObject = xfa.resolveNode(elementName);
vObject.presence = 'visible';
vObject.border.edge.color.value = "0,0,0";
}
Since you are already using two objects for the combed field (presumably with a global binding), then I would set the object with the combs to "Visible - screen only" and the object without the combs to "Visible - print only" (in the Object > Field tab presence dropdown). This would do away with this script.
Hope that helps,
Niall
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies