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!


Community Champion
Community Champion

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

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (3,184)