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

Notifications

Announcements

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,457 Super User 2025 Season 2 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 47 Super User 2025 Season 2

#2
Suriyanarayanan V Profile Picture

Suriyanarayanan V 34

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 26 Most Valuable Professional

Last 30 days Overall leaderboard