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 / Setting a Default Valu...
Power Apps
Unanswered

Setting a Default Value on a Radio Button is Auto Filling Data

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello guys, I've got an issue I haven't encountered before. 

I have a gallery that is patching after a button press, and currently works fine. However there is no default selection on my Radio button, so if the app gets patched again the previous radio selections create a blank in my SharePoint list. 

I thought I could get around this by using ThisItem.Response (this is the field in my SP list my radio button populates). 

This does show the previous selection after a patch, however it then fills this selection into all of the other radio buttons, essentially becoming their default value. I find this strange as this doesn't happen with text boxes that also use ThisItem, and as its in a gallery I assume every section of the gallery is independent of each other. 

I essentially need a way of a user to submit a response, then after the patch there previous radio selection is shown. Again this works perfectly fine in the comments boxes. 

Any advice would be appreciated! 

First Entry: (works fine)

 

HD28_0-1715093206020.png

HD28_2-1715093241371.png

After the patch: (response disappears)

 

HD28_3-1715093308037.pngHD28_4-1715093410385.png

 

If I set the Default to ThisItem.Response.value, it auto fills every gallery item (this doesn't happen with Comments box)

HD28_5-1715093577152.png

 



 

 

 







Categories:
I have the same question (0)
  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Heya @HD28,

     

    I think this is likely because you don't have a null (blank) value as one of your listed radio options, so it defaults to the first it can find since it can't find null.

     

    You can probably work around this by doing a length check to check if there is a selected value, and if not then dont have a value.

    Could you try changing your Default property of the Radio to:

    If(Len(ThisItem.Response.value)>0,
     ThisItem.Response.value
    )

     

     

    Cheers,

    Sancho

  • HD28 Profile Picture
    Microsoft Employee on at

    Hey Sancho, thanks for getting back to me, 

    I give that a go and it is replicating scenario 3, where is the value is becoming the default for all of the radios and populating the whole column in my SP list.

    Do you think adding a blank option in my choices would work? if so could I then hide the blank option in the Gallery? 

    Thanks again

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Heya, not a problem, ok let's look at what else it could be - are you patching this data using a patch statement? If Yes, could you provide the patch statement here please in text format?

     

    If not patching, then you are using a form, in which case, can you look at the datacard for that control and provide the Update property of the Datacard?

  • HD28 Profile Picture
    Microsoft Employee on at

    Yeah I'm using a Patch, here's the code: (Response Input is the radio buttons, and Comments Input is a text box)

    ForAll(
        Filter( Gallery1.AllItems, 'Change Toggle'.Value = true),
        Patch( 'Upload list ', ThisRecord,
        {'Response': 'Response Input'.SelectedText,
        Comments: 'Comments Input'.Text}))


    The Change Toggle = True is referring to a toggle that checks is the gallery row is different to SP List. the code for that is:

    ThisItem.'Response'.Value <> 'Response Input'.Selected.Value || ThisItem.Comments <> 'Comments Input'.Text
     
     
    Thanks again for looking into this for me!
  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Ok, so I did a few tests and it should be able to understand the context if you don't use selectedText and instead use selected.Value in your formula:

     

    ForAll(
     Filter(
     Gallery1.AllItems,
     'Change Toggle'.Value = true
     ),
     Patch(
     'Upload list',
     ThisRecord,
     {
     'Response': 'Response Input'.Selected.Value,
     Comments: 'Comments Input'.Text
     }
     )
    )

     

    Could you give that a try and let me know if that gives better results?

  • HD28 Profile Picture
    Microsoft Employee on at

    Thanks for testing that out, I changed it to 

    {'Response': 'Response Input'.Selected.Value,
    Got this: 
    HD28_0-1715104238138.png
  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Ok, so I had a play around with this and spent some time building a test app with similar functionality to it, i.e. datasource referenced in gallery and radio in gallery - In the end after many experiments I wasn't able to get the reference to the 'control inside the gallery' working from the outside the gallery that way, but I was able to come up with a different approach:

     

    I used the OnChange of the radio control to patch that particular row, instead of running a patch after the fact - that way the choice from the radio is immediately patched to the row:

    Patch(
     'Upload list', 
     ThisItem, 
     {
     Choice1: {Value: 'Response Input'.Selected.Value}
     }
    )

     

    Then make the OnChange for the Comments textInput:

    Patch(
     'Upload list', 
     ThisItem, 
     {
     Comments: 'Comments Input'.Text
     }
    )

     

    Make sure to set the DelayOutput property of the text input to true, that way it will give it a moment until it thinks you are finished typing before it tries to patch 💜

     

    This way any radios that were not chosen, did not patch their value and were left blank - the Default for the radio should still be ThisItem.Response.value and the default for the comments should be ThisItem.Comments 🙂

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 Apps

#1
11manish Profile Picture

11manish 547

#2
WarrenBelz Profile Picture

WarrenBelz 444 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 322

Last 30 days Overall leaderboard