Expand my Community achievements bar.

Hidden subform issue

Avatar

Level 4

I have a form that includes a series of hidden subforms. One hidden subfrom, when called up and when one of its checkboxes is clicked, is supposed to call up different hidden subforms. These last subfroms reside on a different page. I usually use a simple script to call up hidden forms and it works just fine...until now. It won't call up the last subform. It seems that the last subform won't present because it is on a different page.  I dont know why that shold matter, but it seems to.

I've attached the form I am working on. The problem is in getting MathAcc to present on page 3 when LATMathEng on page 2 is checked.

Thanks so, so much to anyone who can help me out.

22 Replies

Avatar

Level 6

See attached form - I think this is what you want.  I may have lost a little bit of your formatting.

The issue was the positioned layout of the form.  When you are hiding subforms and you need the rest of the form to move up and fill in the blank space, you need to use flowed layout.  Fortunately, the way your form is organized it is easy to use a combination of both flowed and positioned layout.  Here's how it works, and I apologize for the long explanation.

When you have a subform that is set to positional layout, the position of each object that you add is set to where you put it relative to that subform.  When you start a new form in Designer, it creates a default subform that is the size of the page; your page is essentially one large subform.  If you add a page 2, a second subform will be created that is also the size of a page.  Everything added to page 2 really gets added to the page 2 subform.  This concept is sort of hidden from newbies since to them it just looks like they're adding objects to pages.  However it's an important concept. Instead of having one large subform that is the size of the page, you might have two subforms, each 1/2 of the page size. Each is set to positioned layout.  When you put objects in the top half of the page, they are going into the top subform, and will be positioned relative to the top-left corner of the subform.  When you add objects to the bottom of the page, they go into the lower subform and be positioned relative to that subform.  If you decide to swap the two subforms on the page, the entire lower section will swap positions with the upper section, but the contents inside will stay in position relative to the other objects inside that subform.  So you can move sections around without the things inside getting mixed up. The position in the hierarchy does not matter, what matters is the x,y position of the object inside the subform.

On the other hand, a subform that is set to flowed layout will display objects inside in strict hierarchical order.  It takes the first object that it contains and places it at the upper-left hand corner.  Then it takes the next object and places it directly below the first.  Then the third below the second, etc.  It butts them up against one another.  If you swap the order of objects in the hierarchy, it will change their order in the subform since order matters.  The x,y value of each object is ignored.

What I did on your form combines both of these behaviors.  Your form was already organized into sections that used positioned subforms, which is good since you don't want the contents of each section to shift around.  Unfortunately those sections were sitting inside page-sized positioned subforms, so that regardless of whether the sections around it were hidden, a section would still be displayed on page two or three or whatever, based on it's x,y relative to the page subform.

Instead, I created a parent subform that is set to flowed.  I then dragged each of the subforms sections that make up the document into that parent subform.  Then I deleted the page subforms, which were now empty.  So what happens now when the form is rendered is: The first subform under the parent ( REQUESTOR INFORMATION, RBC ACCOUNT INFORMATION, SECURITY INFORMATION, all one subform) is placed on the form.  Then the next child (TRANSACTION TYPE) is placed below that.  The next child is TRANSFER INFORMATION; if it is visible it will be placed directly under TRANSACTION TYPE.  However if it's hidden it won't be displayed and the next child,CROSS BORDER DELIVER OUT will be either displayed or not based on whether it's hidden, and so on.  Each of the visible section subforms will flow down the document one after another, without leaving any space in between, and the contents of each will move as a group since the section subforms are positioned.

I hope the above is clear.

The other thing that I did was to group the radio buttons in the TransactionType subform into a Radio Button List.  This makes them automatically operate as mutually-exclusive; only one can be selected at any time.  I put the code in the change event for the radio button list that hides whatever is visible and then makes the appropriate subform visible based on the butten that was selected.

Finally, I added code to the initialize event of the radio button list to default the Transfer Information button as selected on startup, and to set the Transfer Information subform to visible.  All of the other transaction subforms were set to hidden.  You can easily change which subform is the default on startup, or remove that code and set Transfer Information to hidden so that nothing is displayed.

Amazingly, the whole thing took less time to do than writing this response.  Create a subform, drag, delete, write some script.

Hope this helps.

Kevin

Avatar

Level 2

Wow, thank you so much! That really clears things up for me!