Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Show/hide set of text field based on drop down values selection on the power apps portal form

(1) ShareShare
ReportReport
Posted on by 100
Hello,
 
i want to show/hide set of text fields based on drop-down value selection. lets say, in the drop down i will have values like 2,3,4 so on. when they select 2 then only other related two text fields should display not others, Similar way when they select 3 then only related set of text fields will display to enter values. is that possible?
 
Thanks
  • Verified answer
    Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    Show/hide set of text field based on drop down values selection on the power apps portal form
    Hi,
     
    You can add custom JavaScript to the Portal Basic form to fulfill the requirements.
     

    In portal management: 

    1. Under content > Basic forms > Select your desired form > Additional settings 

    2. Scroll down until you see the JavaScript section.

     

    3. Then add the following jQuery

     

    $(document).ready(function() {
            $("#cr95c_customchoice").change(function(){
       
                //Gets the text value of the selected option.
                var selectedOption = $("#cr95c_customchoice")[0].selectedOptions[0].innerHTML;
       
                //Gets the input field named Name.
                var name = $("#cr95c_name");
       
                //When the selected option is Choice 4, the Name field is hidden.
                if(selectedOption === "Choice 4"){
                    name.hide();
                }else{
                    name.show();
                }
            })
        });

     

     

    Here is a related link you can refer to.

    https://www.spyglassmtg.com/blog/power-apps-portal-advanced-forms-web-forms-and-custom-javascript

     

    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me .
     
    Best Regards,
    Dengliang Li
     

     

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans