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 / Get/Set Text in Component
Power Apps
Unanswered

Get/Set Text in Component

(0) ShareShare
ReportReport
Posted on by 39
Hello,
I am creating a component that will allow a user to enter text data, and click a save button. I then need to grab that text and do stuff with it.
 
This component has 3 controls: a TEXTINPUT (commentsText), a button to save and a button to cancel.
 
I have also created 4 custom properties for the control: the OnSaveClick event, the OnCancelClick event, the DefaultText input, and the CommentText output. The DefaultText text is intended to initialize the Text property of the commentText control, and the CommentText property is intended to be what I read to get the users input when the OnSaveClick event is raised.
 
My problem is that I am not able to 1) set the commentText to the DefaultText, and 2) read back what the user entered.
 
I have a button that I use to show the component using the following code in the button's OnSelect property:
rmaCommentBox.DefaultText="Add your comments here...";
UpdateContext({varShowRmaComments:true});
 
I am using this code to read back the user's input:
Notify("Comments: " & rmaCommentBox.CommentText);
 
Inside the component I am setting the Value property of the commentText control to the following code:
CommentBox.DefaultText
 
Then in the SaveButton.OnSelect I am using the following code:
CommentBox.CommentText=CommentBox.DefaultText;
CommentBox.OnSaveClick()
 
I know I'm not doing something right, but I'm not sure what that is. Can anyone lend a bit of insight as to what my problem is?
 
Thanks for looking
Kevin
Categories:
I have the same question (0)
  • IAmIntractable Profile Picture
    280 on at
    This post is interesting to me to see if anyone posts about the fact that you are using an experimental feature (custom behavior). One that has been in the experimental state for 4 years and one that is essential to the Microsoft component strategy. This is concerning. 
     
    That said,
     
    DefaultText is an input property to the component and it needs to be set outside the component in actual use though you can set its default by placing "Add your comments here" to the property inside the component so it has a value to work with during development.
     
    This should read:
    CommentBox.CommentText=CommentBox.Text;
  • KevinBod Profile Picture
    39 on at
    What exactly do you find concerning?
     

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
Vish WR Profile Picture

Vish WR 914

#2
11manish Profile Picture

11manish 617

#3
Valantis Profile Picture

Valantis 598

Last 30 days Overall leaderboard