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 / Trying to show field o...
Power Pages
Unanswered

Trying to show field only if 'Other' is one of the options from a multi-select dropdown.

(0) ShareShare
ReportReport
Posted on by 1

I have tried a bunch of options and I am just not sure what I am doing wrong. I have a dropdown called Accreditation which is set-up as a multi-select. If the user chooses any combination of options, if it includes the "Other" option, I want to then show the Other field.  Hopefully, someone can tell me what I am missing.

 

$(document).ready(function () {
    $("#accreditation").change(onAccreditation);
  onAccreditation();
});
 
function onAccreditation() {
var varSelectedValues = $("#acceditation").val();
 
    if (varSelectedValues && varSelectedValues.indexOf('Other') ! == -1) {
        $('#accreditationother').parent().parent().show();
    } else {
        $('#accreditationother').parent().parent().hide();
    }
};
Thanks for any help!
 
Heidi
Categories:
I have the same question (0)
  • Surendran Ravindran Profile Picture
    212 on at

    Hi @hfournier ,

     

    It seems that there is a minor error in your code. You have inserted a space between "and" and "in" which is leading to a syntax error. Additionally, there is a mistake in the selector that is being used to fetch the values of the "accreditation" dropdown. You need to use "getElementById" instead of "getElementsByClassName". I have made the required corrections in the code for you.

     

    $(document).ready(function () {
     $("#accreditation").change(onAccreditation);
     onAccreditation();
    });
     
    function onAccreditation() {
     var varSelectedValues = $("#accreditation").val();
     
     if (varSelectedValues && varSelectedValues.indexOf('Other') !== -1) {
     $('#accreditationother').parent().parent().show();
     } else {
     $('#accreditationother').parent().parent().hide();
     }
    };

     

    Regards

    Surendran Ravindran

     

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

    I hope that helps.

    If the post solves your problem, please mark it as a solution. If it helps, consider a thumbs up.

  • oliver.rodrigues Profile Picture
    9,453 Most Valuable Professional on at

    In addition to @Surendran_R comments, can you also print the value of the selected option?

    I feel like that's the way to get the value of a single optionset but not multiple, please take a look at this code sample for manipulating multiple choices: Manipulating Choices (Multiselect OptionSet) via J... - Power Platform Community (microsoft.com)

     

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
rezarizvii Profile Picture

rezarizvii 53

#2
DP_Prabh Profile Picture

DP_Prabh 40

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 28 Most Valuable Professional

Last 30 days Overall leaderboard