Skip to main content

Notifications

Community site session details

Community site session details

Session Id : /bhjjK5y3DOx31iifPmMc1
Power Pages - General Discussions
Suggested answer

Check/get selected options from a 'Choices' field using custom Javascript on power pages

Like (0) ShareShare
ReportReport
Posted on 21 Oct 2024 09:59:11 by
I have a choices / multi-select field on power page, where an user can select 1 or more values. the values are Title, first name, last name, age. Based on these list of values, I would want to show the respective field using the custom javascript on power pages.
 
Please let me know how do I check / get the list of selected values from a choices / multi-select control.
 
Thanks in advance.
Categories:
  • Suggested answer
    SaiRT14 Profile Picture
    1,966 Super User 2025 Season 1 on 22 Oct 2024 at 00:31:42
    Check/get selected options from a 'Choices' field using custom Javascript on power pages

    Pls try the following it will fix.

    • Access the Multi-Select Control: First, make sure the multi-select field has a unique ID or class that you can target with JavaScript.

    • Get the Selected Values: Use JavaScript to retrieve the selected values from the multi-select field. In Power Pages, the multi-select field stores values as an array, so you can loop th rough the selected options.

    • Check Which Fields are Selected:You can use the .map() or .forEach() method in JavaScript to get the selected values and then determine which fields to show based on the user’s selection.

    • Show/Hide Fields Based on Selection: Use JavaScript to show or hide the corresponding fields based on the values selected by the user.

  • Suggested answer
    Fubar Profile Picture
    7,885 Super User 2025 Season 1 on 21 Oct 2024 at 22:21:42
    Check/get selected options from a 'Choices' field using custom Javascript on power pages
    This post by Oliver Rodriguez contains a number of pieces of JavaScript for working with multiselect choices

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Pages - General Discussions

#1
WarrenBelz Profile Picture

WarrenBelz 9 Most Valuable Professional

#2
Fubar Profile Picture

Fubar 6 Super User 2025 Season 1

#2
Rondel Profile Picture

Rondel 6

Overall leaderboard