cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hdaniel1
New Member

Switching Tabs on Form Does Not Display Control Updates

I have the following situation:

In a custom entity form designed for creation, I have 2 tabs. In the first tab, there is an option set field. Based on a particular value that is chosen, a field in the other tab gets toggled as required.


Now, when I load the form and change the option set field WITHOUT toggling to the second tab, it sets the field required / unrequired as expected. However, as soon as I switch to the second tab, then switch back to my first and change the option set field again, the 2nd tab field no longer updates. I can see the code fetching that control and setting the requirement level through the debugger, yet the save / form does not reflect the field's updated requirement status. I've also tried doing this through a tabonchange event, but see the same behavior and that is not desirable anyways.

 

I am also able to replicate this in the developer tools directly. Open a form, set a field to disabled or required that currently isn't, and it updates. Then, switch tabs, set it to the opposite of what you did earlier. Switch back - the field did not update, though it seems to have when I fetch the property.

 

Note that everything works fine if both fields are in the same tab, but the requirement is to have them in separate tabs.

 

Has anybody seen this behavior? It seems like a bug, but I'm not sure. If there are workarounds, I would appreciate it! Business rules won't work because this logic needs to be in place before the record is saved, and my understanding is business rules don't work unless it's an existing record.

 

For reference, this is my code for on change:

fieldTypeOnChange = function (executionContext) {
           var frmCtx = executionContext.GetFormContext();
           var attr = frmCtx.getAttribute("fieldtoupdateasrequiredornot");
           var fieldToCheck = frmCtx.getAttribute("fieldtocheck");  
           if (fieldtocheck.getValue() !== null) {
                  attr.setRequiredLevel("required");
           }

           else {
                  attr.setRequiredLevel("none");
           }
};

0 REPLIES 0

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,268)