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 Pages / Basic form lookup rene...
Power Pages
Suggested Answer

Basic form lookup renedered as drop down, hide fields based on lookup rendered as drop down value

(1) ShareShare
ReportReport
Posted on by
I have tried the following to get the lookup rendered as a drop down to hide other fields based on its value
 
   function hideShowSections(executionContext) {

      formContext = executionContext.getFormContext();
     
    RequestTypeLookupName = formContext.getAttribute("requesttype").getValue()[0].id;

    var FieldToSHow = formContext.getAttribute("fundingofficial");

   
      if (formContext.getAttribute("requesttype").getValue()[0].name == "Parking")
   
      {
         FieldToSHow.setVisible(true);
   
      } else
   
      {
         FieldToSHow.setVisible(false);
      }
   
   }
 
 
 
Here is another set of code I tried also unsuccessful
 
//# field with the conditional logic
$(document).ready(function () {
  $("#inspectselectionid").change(onDisplaySectionChange);
  onDisplaySectionChange();
});

function onDisplaySectionChange() {
 var varSubject = $('#inspectselectionid').find("setIsDirty(this.id)").text();
 
// if lookup rendered as dropdown is Parking show justification field else hide    
 if (varSubject === "Parking") {
       
    $('#logicalfieldtoshow').parent().parent().show();
 }
 else {
    $('#logicalfieldtohide').parent().parent().hide();
 }}
 

 
Categories:
I have the same question (0)
  • Suggested answer
    Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at
    The second set of code is closer to what you need as Power Pages does not support the model driven app client side scripting (e.g. formContext) -  Use plain JQuery/JavaScript.
     
    With the second bit of script put in a debugger statement and debug it in the browser - not sure if this line
    $('#inspectselectionid').find("setIsDirty(this.id)").text(); is correct the others look ok 
     
    also in JQuery .change() is deprecated and should now be .on('change', yourfunction)

    Edit: to get the text value from the dropdown you will need to do something like
    $('#fieldschmaname').find("[value='"+ $('#fieldschmaname').val() +"']").text();
    
    //and you will want to check $('#fieldschmaname').val() is not null or empty before that

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!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 21 Super User 2026 Season 1

#2
Fubar Profile Picture

Fubar 19 Super User 2026 Season 1

#3
CN-06091549-0 Profile Picture

CN-06091549-0 18

Last 30 days Overall leaderboard