cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SunilR
Helper I
Helper I

Hide/Show options in Option Set fields

Hi All,

 

I have a two option set fields on a web form step.

Based on selection of first option set I need to hide/show options in the second option set field.

How can i achieve this bu JQuey (Hide/Show options in Option Set field)

 

Thank you.

2 ACCEPTED SOLUTIONS

Accepted Solutions
OliverRodrigues
Super User
Super User

Hi, to hide an option you can use the following via JQuery:

 

$("#<attribute name> option[value='< option set value>']").hide();

for example:

$("#new_myoption option[value='123123']").hide();
------------

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

hardikv
Solution Sage
Solution Sage

Hi @SunilR 

Can you add below code in Web Page/Web Form javascript section:

$(document).ready(function(){
	$("#new_firstoptionsetfieldlogicalname").change(function () {
        // Get value of your trigger field
        let currentVal = $("#new_firstoptionsetfieldlogicalname option:selected").val();

        //do some validation
        if(currentVal == "459490001") {
            $("#new_secondoptionsetfield option[value='123123']").hide();
        } else {
            $("#new_secondoptionsetfield option[value='123123']").show();
        }
    });
 });

 

View solution in original post

2 REPLIES 2
OliverRodrigues
Super User
Super User

Hi, to hide an option you can use the following via JQuery:

 

$("#<attribute name> option[value='< option set value>']").hide();

for example:

$("#new_myoption option[value='123123']").hide();
------------

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

hardikv
Solution Sage
Solution Sage

Hi @SunilR 

Can you add below code in Web Page/Web Form javascript section:

$(document).ready(function(){
	$("#new_firstoptionsetfieldlogicalname").change(function () {
        // Get value of your trigger field
        let currentVal = $("#new_firstoptionsetfieldlogicalname option:selected").val();

        //do some validation
        if(currentVal == "459490001") {
            $("#new_secondoptionsetfield option[value='123123']").hide();
        } else {
            $("#new_secondoptionsetfield option[value='123123']").show();
        }
    });
 });

 

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (974)