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 / Getting a Form Value P...
Power Apps
Suggested Answer

Getting a Form Value Programmatically

(0) ShareShare
ReportReport
Posted on by 6
How can I read the value of a text element on a Power Apps edit form programmatically?
 
E.g. I've put a button on the form and whenever I click the button I want to read the value of whatever the user typed into a text element.
 
And then maybe after reading it, I'll want to change it and write it back. Is that possible with Power Apps?
 
Thanks! 
Categories:
  • Suggested answer
    ronaldwalcott Profile Picture
    3,914 Moderator on at
    You could use something like 
    UpdateContext({varMessage: "Hello, World!"});
    UpdateContext({buttonPressed: true});

    in theOnSelect of a button and 

    If (
        buttonPressed,
        varMessage,
        Parent.Default
    )

    in the default of the datafield but do you want to be able write back the original value and overwrite more than once as the buttonPressed value still needs to be reset (probably on update or cancel). 

    You can read the value by using the text property of the control thus TextInput.Text
  • JB-26112322-0 Profile Picture
    6 on at
    Thanks ronaldwalcott,
     
    So here's what I did that seems to do what I need. 
     
    I create a variable for the text field and set the text field's Default property to equal that variable.
    The button's OnSelect looks like:
     
    Set(varTemp, DataCardValue14.Text);Set(varCCRecipients, Concatenate(varTemp, " says hi"));
     
    • DataCardValue14 is my text field in the edit form; its Default is varCCRecipients
    • varTemp is a temporary variable.
    I was reading DataCardValue14.Text before, but because I wasn't going through a variable to get it to another form element, it appeared that it wasn't working. 
     
    Thanks for your help. 

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 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard