Dynamic Form Behavior in Model-Driven Apps with JavaScript
Short answer
A Using JavaScript on model-driven app form events can dynamically show and hide columns in real time, meeting the client-side behavior goal.
Question
Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution. After you answer a question in this section, you will NOT be able to return to it. As a result these questions will not appear on the review screen. A company uses a model-driven app. The company must be able to dynamically control how components of the form behave as users interact with it. The solution must modify the form in real time while the user interacts with the interface. You need to enforce client-side behavior dynamically. Solution: Use JavaScript to dynamically show and hide columns. Does the solution meet the goal?
Key Takeaways
The question tests whether client-side JavaScript on model-driven app forms can modify form UI at runtime; the common trap is thinking only Power Fx or low-code form rules can change visibility, when the client API explicitly supports show/hide operations.
In model-driven apps, JavaScript web resources attached to form events let you show or hide columns (fields) dynamically as users interact with the form. The proposed solution satisfies the requirement for real-time, client-side form control, so the answer is Yes.
Common mistake: The most common wrong answer is B (No), because learners assume dynamic UI changes require a platform feature like business rules rather than scripting, overlooking that the model-driven client script API provides form.ui.controls getByName(...).setVisible() for exactly this purpose.
Expert Analysis
Why the Answer Is Correct
The model-driven app client-side scripting API (Xrm.Page / executionContext.getFormContext) exposes form controls, and each control supports methods such as setVisible(false/true), setFocus, and getValue/setValue, callable from OnLoad, OnChange, and OnSave events. Because the company only needs to show and hide columns in real time as the user interacts, JavaScript on form events fully satisfies the stated goal with no server round trip. This is a documented, supported customization pattern delivered through web resources registered on the form, so the solution meets the requirement and the answer is Yes (A).Why the Other Options Are Wrong
Option B (No) would be correct only if JavaScript could not affect form appearance or if the requirement mandated a purely declarative mechanism, but the client API clearly manipulates column visibility at runtime. Business rules or Power Fx could also show/hide columns, but the question asks whether this unique solution meets the goal, not whether it is the only or best approach—multiple solutions may be correct in this question set. There are no licensing or mobile-client caveats that invalidate plain show/hide scripting in model-driven apps on modern supported clients.Community Comment Notes
The single community comment agrees with this verdict, stating that "JavaScript can control a model-driven app form in real time on the client side as the user interacts with it." The commenter selected answer A, matching the analysis that dynamic show/hide of columns is exactly what the client scripting API is designed for.Official Reference
Exam Strategy
When a scenario asks whether a single named solution meets a goal, judge only whether that solution is technically capable—not whether it is the only or preferred approach. For model-driven form questions, remember that JavaScript web resources, business rules, and modern Power Fx form-level logic can all change field visibility at runtime.
Frequently Asked Questions
Can JavaScript really change field visibility in a model-driven app form at runtime?
Yes. Client-side scripts attached to form events call the control's setVisible method to hide or show columns immediately without a page refresh or server round trip.
Are business rules or Power Fx also valid for this scenario?
Yes—show/hide can also be done with business rules or modern form logic. The question only asks whether the JavaScript solution meets the goal, and multiple solutions may be correct in this set.
Discussion 1 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded.
From public community threads 1
-
ABCTOC 👍 1 Answered AJavaScript can control a model-driven app form in real time on the client side as the user interacts with it.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.