Skip to main content
Community site session details

Community site session details

Session Id :
Power Pages - Power Apps Portals
Answered

Javascript to display default label on choice field

(0) ShareShare
ReportReport
Posted on by 90

I am using a model driven app form on the Portal. Is there a way to display a default "--Select--" label on a dropdown field when the form first loads, without creating an actual choice called "--Select--" and assigning that as default. Looking to avoid the problem if user does not select anything, then the default value assigned should be blank and not --Select--

 

@OliverRodrigues 

  • Verified answer
    oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on at
    Re: Javascript to display default label on choice field

    So, your flow expects that field to contain a value, is that it?

    if yes, then the choice field should be mandatory.. this way the user can't select the option "--SELECT--".. because that option contains no value

     

    You can apply this change on a dataverse level (change column properties to required).. this will make the column always required, both in Portals and Model-Driven App

    Or if you want it to be only mandatory in the Portals.. you can apply Form Metadata and set it required: https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/configure-web-form-metadata

     

  • Mikello-6626 Profile Picture
    90 on at
    Re: Javascript to display default label on choice field

    Thank you so much for your prompt response as always. I am very close to this but for some reason my Power flow is failing because it detects as no value. Any way to assign a value like "Not selected" behind the scenes if a user keeps it as default "--Select--"? I tried assigning value in this code but it's not working 

    $("#<choice field name>").find("option[value='None selected']").attr("label", "--SELECT--")
  • oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on at
    Re: Javascript to display default label on choice field

    Hi, you can apply JS to achieve that, something like:

    $("#<choice field name>").find("option[value='']").attr("label", "--SELECT--")

     

  • Mikello-6626 Profile Picture
    90 on at
    Re: Javascript to display default label on choice field

    @yashag2255 No, it does not work for choice field. Have you tried it?

  • yashag2255 Profile Picture
    24,568 Super User 2024 Season 1 on at
    Re: Javascript to display default label on choice field

    Hi @Mikello-6626 

     

    To configure this you can use Entity Form Metadata on the form of type attribute and then provide the default value that you are looking for.

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35