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

Set "Allow Page Break within Content" during runtime

Avatar

Level 3

Hi,

Can some help me setting the subform/table property "Allow Page Break within Content" with javascript?. I have a repeating table in a form and want only long tables to break after certain height. Question is simple but I guess answer is not. Cannot find anything after searching for many days.

Thanks

Arvind

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Arvind,

I don't think you can set the "allow page break within content" with JavaScript.  If you set allow page break within content on your table and then you could add a subform that causes a page if the table is small enough to fit on the next page.

You would have to do this in the layout ready event and updating the form structure in the layout ready can cause it to become unresponsive as it causes the event to fire again.  This means you must be careful to remember what has caused the event to fire.

Anyway, here's a sample that should get you started.  https://sites.google.com/site/livecycledesignercookbooks/home/ForcePageThrow.pdf?attredirects=0&d=1

Have a look at the Subform1 layout:ready event code.

Regards

Bruce

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Hi Arvind,

I don't think you can set the "allow page break within content" with JavaScript.  If you set allow page break within content on your table and then you could add a subform that causes a page if the table is small enough to fit on the next page.

You would have to do this in the layout ready event and updating the form structure in the layout ready can cause it to become unresponsive as it causes the event to fire again.  This means you must be careful to remember what has caused the event to fire.

Anyway, here's a sample that should get you started.  https://sites.google.com/site/livecycledesignercookbooks/home/ForcePageThrow.pdf?attredirects=0&d=1

Have a look at the Subform1 layout:ready event code.

Regards

Bruce

Avatar

Level 3

Hi Bruce,

That work superbly, like a charm, no words for it. I did not find any solution to this before this attachment. Sorry I took long to reply.

Can you please explain a little it to me? I tried comments but did not get it.

What xfa.layout.absPageSpan(Subform1)  return ??

It was really what I want.

Thanks a lot and really appreciate you help.

Regards

Arvind

Avatar

Level 10

Hi Arvind,

Glad you got it working.

The absPageSpan() method returns an integer giving the number of pages an object spans, so it your case if it spans more than 1 page we know we have to do something (if it is small enough), Adobe LiveCycle ES4 * absPageSpan

Regards

Bruce

Avatar

Level 3

HI Bruce,

That was really helpful to understand.

Thanks

Arvind