web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building 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:
I have the same question (0)
  • Suggested answer
    ronaldwalcott Profile Picture
    3,827 Super User 2025 Season 2 on at
    Getting a Form Value Programmatically
    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
    Getting a Form Value Programmatically
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 766 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 419 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 235

Last 30 days Overall leaderboard