web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Hiding fields in Quick...
Power Apps
Answered

Hiding fields in Quick View form using JavaScript

(0) ShareShare
ReportReport
Posted on by 42

Hello Experts,

I am trying to hide the Quick View Form Field using the below JavaScript, but sometimes it's working, and sometimes not.

function showAndHideInfo(executionContext) {
var formContext = executionContext.getFormContext();
var quickViewControl = formContext.ui.quickForms.get("testQV");
if (quickViewControl != undefined) {
if (quickViewControl.isLoaded()) {
var value = quickViewControl.getAttribute("dg_defg").getValue();
if (value == 450790000) {//ACTIVE
quickViewControl.getControl("dg_test12").setVisible(true);
quickViewControl.getControl("tg_installmentbillingplanstartdate").setVisible(true);
formContext.getAttribute("blockedprofile").setValue(true);
}
else {
quickViewControl.getControl("tg_installmentbillingenrollmentdate").setVisible(false);
quickViewControl.getControl("tg_installmentbillingplanstartdate").setVisible(false);
formContext.getAttribute("blockedprofile").setValue(false);
}

}
}
}

 

Thanks

-Sri

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    3,306 Most Valuable Professional on at

    Hello,

    I believe your took the code from here - https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/formcontext-ui-quickforms/isloaded

    setTimeout is an elegant way to force your code to trigger after some interval so you can use the code that is similar to the following:

     

    function yourEventHandler(executionContext) {
     var formContext = executionContext.getFormContext();
     var quickViewControl = formContext.ui.quickForms.get("testQV");
     if (quickViewControl) {
     if (quickViewControl.isLoaded()) {
     var value = quickViewControl.getAttribute("dg_defg").getValue();
     if (value == 450790000) { //ACTIVE
     quickViewControl.getControl("dg_test12").setVisible(true);
     quickViewControl.getControl("tg_installmentbillingplanstartdate").setVisible(true);
     formContext.getAttribute("blockedprofile").setValue(true);
     } else {
     quickViewControl.getControl("tg_installmentbillingenrollmentdate").setVisible(false);
     quickViewControl.getControl("tg_installmentbillingplanstartdate").setVisible(false);
     formContext.getAttribute("blockedprofile").setValue(false);
     }
    
     } else {
     setTimeout(yourEventHandler, 10, executionContext);
     }
     }
    }
  • Singapuram Profile Picture
    42 on at

    Thanks you so much @a33ik , and it's working fine now.

  • z.sam Profile Picture
    26 on at

    Hi,

    Can I also show and hide a section within a quick create form?

     

    Regards

    Sam

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 610

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard