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.

Is it possible to have flowing subform in masterpage?

Avatar

Former Community Member

Hello everyone,

I am wondering if it is possible to use subform with flowed content in masterpages. If it is possible, how do you make them to work?


Things i noticed :

- To have a flowing page, normally you have to set the page content to flowing, but in masterpage you cannot set this property.

- According to this flow document of the events, i tend to believe that masterpage layout appear after the layout process, which would maybe prevent the form from flowing?

adobe live designer event flow.png


Any input that could help me?

Thanks alot!

Max

10 Replies

Avatar

Level 6

When you say "flowed" content are you referring to "repeating subforms"? If so, that option doesn't appear to be available for subforms in Masterpages, however, you can create a subform on a Masterpage and have its content flowed Top-bottom or Western as if it was place on a body page.

Just curious..what are you trying to achieve on masterpage vs regular body page?

Avatar

Former Community Member

I have some fields on the masterpage(which is doing my header) that i hide when they are empty. And when i hide those fields, i want to other to move so there is no blank space. In my body page this works well, but in the masterpage it doesn't seem to do anything.

I have also tried to create subform but this doesn't seem to do anything at all.

Thanks!

Max

Avatar

Level 6

Not sure if this is what you are loking to achive but this is what i did:

1. Created a subForm on the Master Page and named it "sub" (see in code below). I placed 3 text fields with the "sub" subform (Field1, Field2, and Field3) and gave it a flow of Western text. I moved and placed the subform at the top of the master page since you mentioned it was for a header.

2. Next, I renamed the default master page name  from (Master Page) to MP. Of course you can use whatever name you desire.

3. Next, I placed a check box on the body page to serve as the trigger to hide one of the fields within the "sub" subform. Note, I needed to copy the absolute-SOM path for the field I want to hide on the master page (MP). This was "form1.MP.Page1.sub.Field2".... NOTE: I included the ENTIRE path starting with form1. If you renamed this default, you must use whatver that name is.

Thus:

form1 = highest in hierarchy list

MP = Name of my master page

Page1 = Default name of subform within MP master page

sub = subform i created which is set to flow (Western)

Field2 = field i want to hide with check box on body page is checked

So the Formcalc code on the check box ended up as:

if ($ == 1)

then

form1.MP.Page1.sub.Field2.presence = "hidden"

elseif ($ <> 1)

then

form1.MP.Page1.sub.Field2.presence = "visible"

endif

Hope this helps!

Avatar

Former Community Member

Thanks for all the help!

But what if you do this code in the initialize event of Field2 of your masterpage?

if ($.rawValue <> "Anything") then

$.presence = "hidden".

endif.

This way, the layout should change at the generation, not using a button.

Does it work in your test?

By the way, in which event are you putting your code for your checkbox?

Max

Avatar

Level 6

If oyu were to place it on the initalize event and open the form for the "first time", chances are Field2 will always be blank, thus it will automatically be hidden - not giving you an opportunity to enter data if needed.

You need somehting to "trigger" Field 2 to become hidden (hence the reason I used a checkbox in my example). For instance, if you placed the script your mentioned above on the "Exit" event of Field 2 (on Master page), then that means you excpect users to enter the field, and "Exit" out of it - but again, it requires an action by the user.  What happens if they don't engage the field? Thus , Exit event might not be the best solution.

I used the "click" or "exit" event on the check box...can't remember.

Avatar

Former Community Member

In my case, the user is not writting anything in these textfields. All the datas comes from a database and everything is filled at the initialization. In this case, there is fields that are hidden at the opening of the pdf.

This is why i'd like to know if masterpage can flow just as body pages.

Max

Avatar

Level 6

Well in that case the Initialize event might work. Also try layout:ready event.

Just note, by placing those fields on the Master page you run the risk of overlapping content (depending on the layout of your body pages).

But yes, hopefully you can see that you can control the presence of objects on the Master page when placed within subforms.

Avatar

Former Community Member

I have taken care of the overlapping don't worry. I know the maximum size of my things and everything fits.

I'll give a try to layout:ready event.

Avatar

Level 1

Hi

Did you ever manage to solve this one ?
I'm strugling with the exact same thing, and have tried almost everything without luck.......

Fingers crossed

Avatar

Level 1

Hello,

In Master pages, you cannot make a subform flowed, If you create it as Flowed also, it will not work.

 

Say you have a you are having 3 fields in a subform. It may happend in the 2nd field the value may be NULL or not NULL.

So you can create 2 subform. One with all the three fields, another with 1st and 3rd field. Also add a field(make it exclude form layout) and in the code set some flags based on the value of the 2nd field. Write Script in both the subform.

Script will be like below: in Initilize event in Formcalc.

if( $.V_2nd_FLAG.rawValue == null) then

$.presence = "visible";
endif;