Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

Form height doesn't collapse when using context variable

I have had some success with setting form heights dynamically by using IF statements.  An example would be:


In this scenario, there is a toggle, that when switched to "Yes" displays the form panel, and when switched to "No" hides the form panel, as the height is changed to 0.  There are some scenarios where certain data cards are removed from visibility. For these, I change the visibility of the objects inside the card to 0, and I change the height of the data card to 0, and the form resizes itself as expected.  For the most part.

Sometimes these forms don't always expand and contract perfectly, at least while working in the editor, and scroll bars become visible.  But generally this method works mostly ok in playback mode or when published and played in the browser.  Not 100%, but kinda works.

I needed to hide some data cards with buttons, so I used a context variable.  This works.  But now the form in question no longer contracts to a shorter length when the fields are hidden using the variable.  So the dynamic form resizing works with the IF statements, but doesn't work with the context variable.  Please see screenshots.  And thanks!


Super User
Super User

Hi @JRuss 


I assume you are setting the visible property of the Card, not the controls. In general, we don't need to adjust the height of the control. Only change the visible property of the card.




And also you have to use a Scrollable screen



We have a similar scenario with one of our current projects and the above works charmly. We have very complex logic to enable control.

Stalin - Learn To Illuminate

Hi @StalinPonnusamy,

We are conditionally setting the visibility of the objects inside the card (StarVisible, DataCardKey, ErrorMessage, DataCardValue) and conditionally setting the height of the card itself, in order to make the cards "disappear" conditionally.  And yep, using a scrollable screen.

Helpful resources

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,849)