cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Newmayer
Regular Visitor

Show/Hide form fields based on a boolean field in dynamics portal

Hi!

Could you provide me assistance in writing a Javascript to show/hide form fields based on a boolean field in the dynamics portal?

Newmayer_0-1621262442371.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
OliverRodrigues
Super User II
Super User II

Hi, you can try the following:

$(document).ready(function () {
    MyFieldChanged();
    $('#<my field>').on("change", MyFieldChanged);
});

function MyFieldChanged() {
    var selectedValue = $('#<my field>').val();
    if (!!selectedValue && selectedValue == "<my value>") {
      $("#<field name>").closest("td").find("div.control, div.info").hide();
    }
    else {
      $("#<field name>").closest("td").find("div.control, div.info").show();
    }
}

 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

View solution in original post

2 REPLIES 2
OliverRodrigues
Super User II
Super User II

Hi, you can try the following:

$(document).ready(function () {
    MyFieldChanged();
    $('#<my field>').on("change", MyFieldChanged);
});

function MyFieldChanged() {
    var selectedValue = $('#<my field>').val();
    if (!!selectedValue && selectedValue == "<my value>") {
      $("#<field name>").closest("td").find("div.control, div.info").hide();
    }
    else {
      $("#<field name>").closest("td").find("div.control, div.info").show();
    }
}

 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

View solution in original post

Newmayer
Regular Visitor

Thanks for the input we made it work!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Users online (19,032)