I would like to have a button on my 3 page form that resets pages 2 and 3 but not page 1. Can this be done?
Thanks!
Wes
Solved! Go to Solution.
You should have the right path to get the somExpression...
When you start a reference_syntax with 'xfa' you must specify which property you want to access,
because you want to access you form, you must specify form as the following:
Hi,
sure, you can use the resetDate methode with a comma separated list of som expressions of objects to reset-
xfa.host.resetData(xfa.form1,page2.somExpression, xfa.form.page3.somExpression);
Views
Replies
Total Likes
Can you show me how to implement this?
Views
Replies
Total Likes
Place a regular button in your form and add this script to its click event.
That's it.
Well, you will propably have to change the list of som expression, so it will fit your form design.
Views
Replies
Total Likes
So if I am trying to reset ~150 fields on page 2 and 3, do I need to insert each of their SOM expressions into the script? Or is there a way to make it general to page 2 and 3?
Views
Replies
Total Likes
If you add the SOM expression of page 2 the method will reset the data of all child elements of this page.
Views
Replies
Total Likes
Okay this does not appear to be working. I may have the SOM expressions wrong for the pages. I want “SAMPLE_PG_1” and “SAMPLE_PG_2” to clear but data on “FORM” to remain.
Views
Replies
Total Likes
Sorry this was supposed to be included on the last post.
Views
Replies
Total Likes
Hi,
the resetData() method requires strings, to resolve the node(s) to reset.
In your sample you're pointing to XFA objects so the method fails.
Add the property .somExpression which returns the SOM expression as a string, then it should work.
xfa.host.resetData(xfa.ONE.SAMPLE_PG_1.somExpression, xfa.ONE.SAMPLE_PG_2.somExpression);
Views
Replies
Total Likes
“Add the property .somExpression which returns the SOM expression as a string, then it should work.”
Please excuse my ignorance but I am not sure what the above statement means. What is the “.somExpression” I should be using?
Wes
Views
Replies
Total Likes
Hi,
somExpression is a scripting property of XFA nodes, that will return the full qualified SOM expression (as a string) of the current node.
Just try the script I posted above.
Views
Replies
Total Likes
I put this script…
xfa.host.resetData(xfa.ONE.SAMPLE_PG_1.somExpression, xfa.ONE.SAMPLE_PG_2.somExpression);
into the click event and it did not work. My button is on page three and when I fill out fields on each page and press it, the field all still have data in them.
It is set as JavaScript ran at Client
Views
Replies
Total Likes
I suggest you do it separately:
xfa.host.resetData(xfa.ONE.SAMPLE_PG_1.somExpression);
xfa.host.resetData(xfa.ONE.SAMPLE_PG_2.somExpression);
Views
Replies
Total Likes
Still doesn’t work.
Thanks for your help. I’m not sure what to do
WES
Views
Replies
Total Likes
You should have the right path to get the somExpression...
When you start a reference_syntax with 'xfa' you must specify which property you want to access,
because you want to access you form, you must specify form as the following:
Excellent! That worked.
Thanks so much for your help!
I love my Community!
Wes
Views
Replies
Total Likes
HI All!
I am wanting to do the same thing but a little different. I have java script that hids and shows certain fields depending on the check boxes that you choose (or radio buttons) Is there anyway to reset the page back to what it was at the beginning, all hidden fields hidden and all fields that should be showing, showing? Can that be done? the reset doesn't make that happen?
Thanks!
Jodi
Views
Replies
Total Likes
Hi jodi
yes it is possible if you get to reset the field's form, once that is done you can remerge the form using the following
xfa.form.remerge();
Note that remerging the form also re-initialize any data in variables back to default
Views
Replies
Total Likes
Thanks Magus!
I will try it! I will throw you another question Is there a way to reset specific subforms or not reset specific sub forms. The form I am creating there is a section that is filled out by a department. They save the form then send the rest to be filled out by a vendor. If the vendor starts their portion and then wants to start over is there a way to reset jus their section and then use remerge and it not affect the section filled out by the department?
Thanks!
Jodi
Views
Replies
Total Likes
Okay I was able to reset my data for only a specific subform! Yea!! I can get xfa.form.remerge() to work also but want to know if there is a way to only remerge the same subform that I reset the data for. Can that be done? Thanks for all your help!
Jodi
Views
Replies
Total Likes
Hi Jodi, I think what you are looking for would be something like this:
Views
Replies
Total Likes