Expand my Community achievements bar.

SOLVED

Presence script doesn't work anymore

Avatar

Level 2

Hallo all,

In my form I'm using the .presence mode to hide or view the subforms. I tested it before christmas and it worked, but if I want to use it now it doesn't work.

Is there anything that could be wrong?

greetings,

Timo

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Timo,

The script looks good. Can you open the JavaScript Console (Control+J) in preview or in Acrobat and see are there any errors when you interact with the checkbox (?).

Also check the names of the subforms. Referencing objects is case sensitive. Also see if you have given a full enough reference to the subforms. For example if they are on a different page, then you will need to provide a more complete reference, eg page2.Aanstelling.presence = "visible";

Come back if you are still having problems,

Niall

Assure Dynamics

View solution in original post

8 Replies

Avatar

Level 10

Hi Timo, make sure that the form is saved as a Dynamic XML Form in the save as dialog. If the form is saved as Static, the presence won't work. Hope that helps, Niall

Avatar

Level 2

Hi Niall,

The form is an dynamic XML form and the preview interactive, so the settings are all good.

Could you check my script? The names who written for the presence command are subforms.

if

(this.rawValue == 1)

{

//Ontslag weergeven

Ontslag.presence

= "visible";

//Aanstelling verbergen

Aanstelling.presence

= "invisible";

Aanstellingvervolg.presence

= "invisible";

}

else

{

//Ontslag verbergen

Ontslag.presence

= "invisible";

//Aanstelling weergeven

Aanstelling.presence

= "visible";

Aanstellingvervolg.presence

= "invisible";

}

Greetings,

Timo

Avatar

Correct answer by
Level 10

Hi Timo,

The script looks good. Can you open the JavaScript Console (Control+J) in preview or in Acrobat and see are there any errors when you interact with the checkbox (?).

Also check the names of the subforms. Referencing objects is case sensitive. Also see if you have given a full enough reference to the subforms. For example if they are on a different page, then you will need to provide a more complete reference, eg page2.Aanstelling.presence = "visible";

Come back if you are still having problems,

Niall

Assure Dynamics

Avatar

Level 2

Hi Niall,

Thanks for your answer, but that's not the problem. I've marked the names and hold the ctrl key and clicked on the subform. the script is now changed but it is still not working.

Is it possible to send you a private Message with this forum?

Here's my script.

if

(this.rawValue == 1)

{

//Ontslag weergeven

Ontslag.presence

= "visible";

//Aanstelling verbergen

Aanstelling.presence

= "invisible";

xfa.resolveNode("#subform[4].Aanstellingvervolg").presence

= "invisible";

}

else

{

//Ontslag verbergen

Ontslag.presence

= "invisible";

//Aanstelling weergeven

Aanstelling.presence

= "visible";

xfa.resolveNode("#subform[4].Aanstellingvervolg").presence

= "invisible";

}

Avatar

Level 2

Hi Niall,

I've found that all document settings are dynamic, but I saved it as an static form. The script works know, but not on page 2.

Is my script incorrect? The second page has the name pagina2 and the debugger doesn't show any error.

Is it also possible to hide the second page if the first option is selected?

if

(this.rawValue == 1)

{

//Ontslag weergeven

Ontslag.presence

= "visible";

//Aanstelling verbergen

Aanstelling.presence

= "invisible";

Pagina2.Aanstellingvervolg.presence

= "invisible";

}

else

{

//Ontslag verbergen

Ontslag.presence

= "invisible";

//Aanstelling weergeven

Aanstelling.presence

= "visible";

Pagina2.Aanstellingvervolg.presence

= "invisible";

}

Greetings,

Timo

Avatar

Level 10

Hi Timo,

Yes, the form needs to be saved as a Dynamic XML form for the dynamic behaviour to work.

Yes, you can hide a page. Just watch for capitals in your object references: in your message you have pagina1, but in your script you have Pagina2.

// this will hide the second page, but leave a blank page

pagina2.presence = "invisible";

// this will hide the second page completely

pagina2.presence = "hidden";

There is an example here: http://www.assuredynamics.com/index.php/category/portfolio/changing-an-objects-presence-and-relevant...

In your script you are changing the presence of "Pagina2.Aanstellingvervolg". This will affect the subform "Aanstellingvervolg" on Pagina2, and not Pagina2 itself.

Hope that helps,

Niall

Assure Dynamics

Avatar

Level 2

Hi Niall,

Thanks for the response, I understand the option "hidden" but it doesn't work so well. I've send you my form as private message, could you look at it.

I want that the second page appears when option 2 is selected. In my document "pagina" means page.

greetings,

Timo