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 / Hide label in form wit...
Power Pages
Unanswered

Hide label in form with JavaScript

(0) ShareShare
ReportReport
Posted on by 118

Hi,

 

I have been trying to hide two fields input and its labels for a visualization and edit form and have only had success for the input. I have the following code: 

 

$(document).ready(function() {
var sociedad = $("#cr027_sociedad").val();
//Sociedad == "Banco"
if(sociedad == 212520000){
$(".section[data-name='Fundacion_Universia_tab']").closest("fieldset").hide();
$(".section[data-name='Pais_tab']").closest("fieldset").hide();
}
//Sociedad == "Fundacion"
else if(sociedad == 212520002){
$(".section[data-name='Pais_tab']").closest("fieldset").hide();
$("#cr027_cuenta").style.display = 'none';
//$("#cr027_cuenta_label").style.display = 'none';
$("#cr027_presupuesto").style.display = 'none';
//$("#cr027_presupuesto_label").style.display = 'none';
}
//Sociedad == "Pais"
else {
$(".section[data-name='Fundacion_Universia_tab']").closest("fieldset").hide();
$("#cr027_cuenta").style.display = 'none';
//$("#cr027_cuenta_label").style.display = 'none';
}
});

 

The fields names are cr027_cuenta and cr027_presupuesto. In the case of the visualization form, when uncommented, it only hides the input, leaving the label behind. Using the same name with "_label" doesn't work either. 

 

When trying this on the edit form it doesn't do anything at all. 

 

Thanks in advance.

 

Categories:
I have the same question (0)
  • Verified answer
    oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at

    Hi, can you test the following code to hide your element:

    $("#firstname").closest("td").find("div.control, div.info").hide();

    just replace firstname for your field name

     

    ------------

    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.

     

  • MS5 Profile Picture
    118 on at

    Works perfectly, thanks!

  • Summer Garg Profile Picture
    48 on at

    Hi,

     

    Check this one:

    https://crmhub.blogspot.in/2017/11/how-to-use-java-script-in-adx-studio.html

     

    For more tutorial list , check this one :

    https://crmhub.blogspot.com/p/d365-portal-adx-studio-portal.html

     

    Keep Learning, keep Sharing , Keep Growing !!!

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…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard