Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Livecycle - remerge partial form

Avatar

Level 2

Hi all,

I am creating a smartform which consist of 2 "pages", Affiliatepage and AVNPage, with a lot of hidden fields.

1225615_pastedImage_0.png

I am trying to add a button on each page that remerge only that page ( so only Affiliatepage or AVNPage).

I succeeded in adding buttons that clears the data,

1225646_pastedImage_1.png

but I also need buttons that remerge the whole page. I tried many types of scripting but none seem to work. I tried adding the name of the object between the brackets but that does not work.

1225647_pastedImage_2.png

Can anyone help me with this?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi there,

Sorry for the inconvenience.. seems like I removed the statement to reset visibility for objects and replaced it with remerge only...

On top of function getAllFields just add this snippet code :

View solution in original post

11 Replies

Avatar

Level 10

Hi there,

I've made up a discussion with an example form that resets parts of forms,

it also includes the option to remerge the whole form.

The function reset I created in this example resets back all objects back to their initial visibility.

If this can help you take a look at it, any feedback is also welcome!

I don't think the remerge option is what you are looking for, you might want to remove that option for your needs.

Validation / Reset Functions, easy to manipulate and to change Forms!!!!

Hope it will help!

Avatar

Level 2

Many thanks in advance. I will check it and let you know.

Avatar

Level 2

Hi,

I checked the post and your PDF, but am not sure how to proceed.

I expected a remerge to be what I was looking for to completely reset only 1 of the 2 pages, as below for instance the object called "Affiliatepage".

I expected the scripting visible below to to just that but it does not.

What am I doing wrong?

1227993_pastedImage_0.png

Avatar

Level 10

Hi there,

unfortunately, I doubt xfa.form.remerge can remerge part of the form only..

If you use the functions I provided in my form, the script object objReset contains functions to retrieve all objects withing a part of the form. you can call only the function xfa.host.reset with a function within that script object to have your form remerged.. use the functionality with the following :

Avatar

Level 2

Thanks Magus!

However if I apply this script and test run it, nothing happens, or to be more precise, it counts as a regular mouseclick.

I am no scriptingwizard so maybe I am interpreting your solution incorrectly?

1229581_pastedImage_0.png

Avatar

Level 10

Have you inserted the objReset script object in your form and inserted the function accordingly in the object as well?

Avatar

Level 2

hmm no I did not.

As I said I have no JS knowledge so please go easy on me

From studying your form and specifically the "Reset all but Specific Fields"- button, it seems i need to add a script object in my form on the form level and name it "objReset" (seems easy enough) but I am not sure what you mean with : "inserted the function accordingly in the object as well?"

Hope you have the patience to help me out

Avatar

Level 10

When creating a script object in LiveCycle for a PDF form, the script object is empty at first, so you must build it by inserting functions within that script object.

So if you look inside the objReset script object in my form, you can see that there is code in there, by copying the content of the script object and pasting it in the script object you created in your form, you will be able to access the objReset.getFields() function.

Make sure that the script object you have created in your PDF form has the name objReset!

Hope this help!

Avatar

Level 2

Ah, my Livecycle was set to only show events with scripts. Switched to All Events so now I see the scripting.

I copied all of it and added it to the objReset i created in my form:

1230560_pastedImage_0.png

The code for the actual button now looks like this:

1230549_pastedImage_1.png

The data now is removed from the fields that contained data, but the the hidden fields that became visible are not made hidden again.

Avatar

Correct answer by
Level 10

Hi there,

Sorry for the inconvenience.. seems like I removed the statement to reset visibility for objects and replaced it with remerge only...

On top of function getAllFields just add this snippet code :

Avatar

Level 2

This did the trick!

So don't you worry about any "inconvenience" for trying to help me

I'd like to thank you very much for providing fast answers all the way to the solution!

Very much appreciated!!