cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Set text field with a value using a button (OnSelect)

Hi All,

 

Happy 2020 !!

 

I have a very simple question here, I need to be able to click on a button that will set a "Single Line of Text" field with a value.

 

I am using currently a variable to update the text field but the problem when I open again the form the text field is blank since the variable value was reset, please find attached screenshot on how I am doing it.

 

My question: is there a way to set the text field with a value that will not change when I re-open the form?!

 

thank!

 

reg

Eyad 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Set text field with a value using a button (OnSelect)

@EMohaisen 

Agreed, we will have to write some new code here but not for the OnSelect property.

 

My suggestion is for the form to show the value from 'ThisItem.'(TEXT Temp) Request Status' until the user clicks the New Submit which changes it to "01-Sending".  To do this I would change the Default property to the following code:

 

If(
    IsBlank(VarTempRequestStatus),
    ThisItem.'(TEXT Temp) Request Status',
    VarTempRequestStatus
)

 

Give this a try and come back to the forum with any questions.

 

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

5 REPLIES 5
Highlighted
Super User
Super User

Re: Set text field with a value using a button (OnSelect)

@EMohaisen 

Assuming your form submitted successfully you should use code like this in the Default property.  Make sure 'Request Status' is changed to the field name matching your spreadsheet.

ThisItem.'Request Status'

 

---
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."

Highlighted
Helper I
Helper I

Re: Set text field with a value using a button (OnSelect)

Hi @mdevaney 

 

Thanks for the reply.

 

Sorry, I didn't get your solution here, I changed the default value as you mentioned, but what I should write now on the button's "OnSelect"? please find my new screenshot and also you may want to have a look at the original screenshot on this post.

 

Thanks again for your help!

 

reg

Eyad

 

Highlighted
Super User
Super User

Re: Set text field with a value using a button (OnSelect)

@EMohaisen 

Agreed, we will have to write some new code here but not for the OnSelect property.

 

My suggestion is for the form to show the value from 'ThisItem.'(TEXT Temp) Request Status' until the user clicks the New Submit which changes it to "01-Sending".  To do this I would change the Default property to the following code:

 

If(
    IsBlank(VarTempRequestStatus),
    ThisItem.'(TEXT Temp) Request Status',
    VarTempRequestStatus
)

 

Give this a try and come back to the forum with any questions.

 

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

Highlighted
Helper I
Helper I

Re: Set text field with a value using a button (OnSelect)

Thanks a lot @mdevaney  !

 

This works and solved my problem, an excellent idea!

 

reg

Eyad

Highlighted
Super User
Super User

Re: Set text field with a value using a button (OnSelect)

@EMohaisen 

You are most welcome.  Take care my friend.

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,280)