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 / Disable Field on the b...
Power Pages
Answered

Disable Field on the basis of Option

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

I have two options "True", "False" in entity form on power apps portal which i have created in cds. I am trying is to disable location field  if i select False in the option.

Ahmad-KAISPE_0-1595227525702.png

Ahmad-KAISPE_1-1595227753800.png

 

I tried to get some help from this thread, unfortunately it throws an error.

 

Can anyone please guide me on this?

Thanks

Regards,

Ahmad 

Categories:
I have the same question (0)
  • the365bit Profile Picture
    136 on at

    Hi @Anonymous

     

    You can do that by adding javascript into your entity form.  The steps below should help you:

     

    1. Go to your entity forms and select the one you want to add the custom behavior

     

    the365bit_0-1595229880191.png

     

    2. Click on Additional Settings and scroll down until "Custom Javascript" and add the statement changing the values for your fields ids

     

     

    $(function(){
     $("#your-options-field-id").change(function(){
     // check if selected value is false
     // if it's false set the lookup field as disabled
     if(!$(this).val()){
     $("#your-lookup-field-id").prop( "disabled", true );
     }
     })
    })

     

     

     

     

    the365bit_1-1595230244318.png

     

    3. Clear the portal cache

     

    the365bit_0-1595230362666.png

     

    Best regards,


    If this post helps, then please consider Accept it as the solution to help the other members find it more
  • Verified answer
    H V Profile Picture
    1,510 on at

    Hi @Anonymous 

    Please try below code to hide/show Lookup field:

     

    $( document ).ready(function() {
    	if($("#crf94_options_0").is(":checked")){
    		$("#crf94_cliniclocation").closest("td").find("div.control, div.info").hide();
    	}else{
    		$("#crf94_cliniclocation").closest("td").find("div.control, div.info").show();
    	}
    	
    	$("#decisionmaker_0").change(function(){
     if($("#crf94_options_0").is(":checked")){
     $("#crf94_cliniclocation").closest("td").find("div.control, div.info").hide();
     }else{
     $("#crf94_cliniclocation").closest("td").find("div.control, div.info").show();
     }
     })
    	
     $("#crf94_options_1").change(function(){
     if($("#crf94_options_0").is(":checked")){
     $("#crf94_cliniclocation").closest("td").find("div.control, div.info").hide();
     }else{
     $("#crf94_cliniclocation").closest("td").find("div.control, div.info").show();
     }
     })
    });

     

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 48

#2
Valantis Profile Picture

Valantis 46

#3
rezarizvii Profile Picture

rezarizvii 43

Last 30 days Overall leaderboard