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
Super User

@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
Super User

@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
Super User

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
Super User

@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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,065)