cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
byansakura
Advocate II
Advocate II

Hide Date Field in Power Portal Web Form

Hey, I was configuring a way to hide a field and it worked on text field, however when I applied that to date field it didn't work. I've tried the usual hide and the one that destroys the datepicker but still none of them works. Is there any way to do that? Thank you in advance!

The snippets I've tried:

$(function () {
 $( "#cr898_AvaibilityDate").closest("td").hide();
});

and this 

$(function () {
    var $ava = $("#cr898_Availibility");
    $( "#cr898_AvaibilityDate" ).datepicker();
    $ava.change(function () {
        if ($ava.val() === "385140002") { // use actual option set value for 'Other...'
            $("#cr898_AvaibilityDate").prop("readonly", false);
        } else {
            $( "#cr898_AvaibilityDate" ).datepicker( "destroy" );
            $( "#cr898_AvaibilityDate" ).hide();
        }
    }).change();
});
1 ACCEPTED SOLUTION

Accepted Solutions
OliverRodrigues
Super User II
Super User II

Hi

where are you placing your JS? did you put it within a $(document).ready statement?

make sure to add 

this is the code I normally use for hiding fields, but your one should also work

 

$(document).ready(function(){

    $("#birthdate").closest("td").find("div.control, div.info").hide(); // show();
});

 

for this kind of logic I normally like adding the JS against my entity form / web form step

 

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

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.




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

3 REPLIES 3
OliverRodrigues
Super User II
Super User II

Hi

where are you placing your JS? did you put it within a $(document).ready statement?

make sure to add 

this is the code I normally use for hiding fields, but your one should also work

 

$(document).ready(function(){

    $("#birthdate").closest("td").find("div.control, div.info").hide(); // show();
});

 

for this kind of logic I normally like adding the JS against my entity form / web form step

 

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

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.




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

Thank you, @OliverRodrigues   I've tried this but it still doesn't work. Did I miss something?
byansakura_0-1600521463431.png

 

justinburch
Microsoft
Microsoft

Hi @byansakura,

Just to be safe here, you have #cr898_Availability and #cr898_AvaibilityDate - should it be #cr898_AvailabilityDate? If that's actually the schema, then no worries.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,837)