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 Apps / Default Form Field Bas...
Power Apps
Unanswered

Default Form Field Based on Gallery Selection

(0) ShareShare
ReportReport
Posted on by 42

powerappscreenshot.pngI have what I thought was a simple problem.  I have a form connected to a Sharepoint list.  I've included a feature where users can complete the form by selecting buttons.  The "buttons" are actually just items in a different Sharepoint list for things like hair color and eye color.  What I want to do is have a user select an item in a gallery that says for example, "Blue Eyes" and then have the datacard value in the form for eye color default to blue and so on with hair color, sex, etc.  What I assumed would work is onselect on a gallery item:  Set(varhaircolor,ThisItem.ChosenColor) and then the default of the datacard as simply varhaircolor.

This doesn't work and I guess it's wanting a text value and not a record value but I'm not sure how to fix this and make it work.  Any help is much appreciated!

Categories:
  • Gochix Profile Picture
    1,937 Moderator on at

    @Friscosammy ,

     

    Instead of ThisItem.ChosenColor use:

     

    Set(varhaircolor,ColorValue(ThisItem.ChosenColor))

     

     

    I assume you set the DataCard Fill property to varhaircolor variable.
    _____________________________________________________________________________________
    Please give a thumbs up if I resolved your issue! Please click Accept as Solution to close the topic!

  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Friscosammy ,

     

    The Default of label expects text. What is date type of ChosenColor column?

    If the ChosenColor are Color data type, I recommend you add a column for Items of gallery, the column saves color name in text format.

    [{ChosenColor:Color.Red,Color:"Red"},{ChosenColor:Color.Yellow,Color:"Yellow"}]

    Then modify your formula on OnSelect.

    Set(varhaircolor,ThisItem.Color)

    Default of Label.

    varhaircolor

    Another method is put your formula on Fill property of label, Fill expects Color data type and I think it will help user see what the selected color looks like.

     

     

    Best regards,

    Rimmon

  • Friscosammy Profile Picture
    42 on at

    I think I may have not been descriptive enough in my original post.  The gallery of options a user can select is a text column in a sharepoint list called ChosenColor.  When selecting an item in the gallery, I just want the text of the ChosenColor, e.g. "Blue" or "Brown" or "Blonde", etc. to default into a text datacard for the form which is attached to its own sharepoint list as a datasource.

  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Friscosammy ,

     

    So, the ChosenColor is already a text column.  Your current formula has no obvious problem. Is there any error about it? Hope you can provide some screenshots.

    Have you tried this?

    Set(varhaircolor,Gallery.Selected.ChosenColor)

     

     

    Best regards,

    Rimmon

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard