cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BubbleGhost
Frequent Visitor

Make a button enter a value in a text field.

Hi Power App Community,

 

I have a request that should have a simple solution but I cannot figure out how to do it. 

 

I created a button and want that button to enter a value of 27 in a text input field. The text input field is later used in a calculation and I got that portion of it working. The text input field already has a number in there (6) and I want to replace that number with 27 every time I press this button. How do I do it using OnSelect? Any help is appreciated. 

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@BubbleGhost 

Put this code in the OnVisible property of the screen.

 

Set(myCustomValue, Blank())

 

Use this code in the Default property of the Text Input you want to change to 27.

 

myCustomValue

 

Finally, take this code and use it in the OnSelect property of the button

 

Set(myCustomValue, 27);
Reset(Text_Input_FieldName);

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

11 REPLIES 11
mdevaney
Super User III
Super User III

@BubbleGhost 

Put this code in the OnVisible property of the screen.

 

Set(myCustomValue, Blank())

 

Use this code in the Default property of the Text Input you want to change to 27.

 

myCustomValue

 

Finally, take this code and use it in the OnSelect property of the button

 

Set(myCustomValue, 27);
Reset(Text_Input_FieldName);

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

eka24
Super User III
Super User III

Insert a button and put this variable:
Set(No27,"27")
Then in the Textboxi default property put this:
Reset(Textbox1);No27

Anytime you press the button, the figure will change to 27

Replace Textbox1 with the actual name of your input textbox where user will enter data.
mdevaney
Super User III
Super User III

@BubbleGhost 

Did either @eka24 or I solve your question.  If yes, please accept as solution.  You can accept more than one solution.

Neither one worked.

 

I'm trying different combinations right now to get it work and will select a solution when I'm done.

@mdevaney 

 

I followed your instructions but when I click run and then click the button, nothing happens. No errors either.

@mdevaney @eka24

 

I'm going to post some screenshots soon but nothing happens when I click the button after your suggestions.

@BubbleGhost 

 

 

From my tests the comma "," should be replaced with a semicolon ";"  using @mdevaney  approach.

After  chaning this the button works fine in my testapp.

 

kind regards,

David

@David_Handke 

The reason I used commas is because my PowerApps tenant locale is set to English.  Those with other languages must used semi-colons instead of commas.  So far I know this is the case for Dutch, Spanish and Portuguese.  Others definitely exist.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

attachments

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (61,005)