Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Presence script at docReady event of form !!

Avatar

Level 4

Hi,

I have a simple form having 1 Checkbox (Default Unchecked) and 1 Textfield. Both are in separate sub-forms. I am trying to make presence of TextField visible when the checkbox is checked. Script is working fine for Checkbox change event but not for Docready event.

Can see the pdf form here: http://dl.dropbox.com/u/5141935/ErrorInVisibility.pdf

Snapshot:

ErrorInVisibility.jpg

I have also checked the same on form's ready, layout ready event...(just for hit & trial) but not working with either.

There is a big version of form it's just a boiled down version of problem.

Pls tell what I am doing wrong !!

Thanks.

-

Abhinav

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Here is the form back: https://acrobat.com/#d=lVnQIhP4B4t0A-N9prn4hQ

I would use the click event of the checkbox for changing the visibility of the subform. Then in the docReady event of the checkbox you can fire the script in the click event.

At design time you can also set the presence of the subform to hidden/invisible. This way you would not need the script in the docReady event.

Hope that helps,

Niall

Assure Dynamics

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

Here is the form back: https://acrobat.com/#d=lVnQIhP4B4t0A-N9prn4hQ

I would use the click event of the checkbox for changing the visibility of the subform. Then in the docReady event of the checkbox you can fire the script in the click event.

At design time you can also set the presence of the subform to hidden/invisible. This way you would not need the script in the docReady event.

Hope that helps,

Niall

Assure Dynamics

Avatar

Level 4

Thanks a lot.

I have to deploy this form on LC ES2 and in process checkbox selection will be coming from XML Form data, So I must have to check it at docReady.

Can you tell me what is the difference between Form's docReady Vs CheckBox's docReady? As I think Form's docReady should fire when complete form is rendered ! Am I wrong?

Thanks.

-

Abhinav

Avatar

Level 10

Hi Abhinav,

The docReady event is the last event to fire once the form is rendered and the data merged. It's a great event as it fires only once.

I would have said that there was no difference between script in the docReady event of the checkbox and the docReady event of the root node. The checkbox docReady event also fires once the form is fully rendered.

The docReady event is an application event and all objects with script in this event fire pretty much at the same time. I am not aware of any priority or sequence for objects in the hierarchy. In any case there can only be milliseconds in the difference.

Good luck,

Niall