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

Add to text field and submit a form when a button is pressed

I am sure this is a very stupid question but I am failing to figure it out.

 

What is the best way to insert into a text field and submit a form when a button is pressed? 

 

I using a SharePoint list as the data source.

 

This is what I thought would be the correct way to do it, however, it is not working:

UpdateContext({Status_DataCard1:"Pending"});SubmitForm(EditFormSave)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Add to text field and submit a form when a button is pressed

Set the text in a variable and keep the default property of the label to this variable.

Something like:

UpdateContext({textVar:"Pending"});SubmitForm(EditFormSave)

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

View solution in original post

7 REPLIES 7
Highlighted
Super User
Super User

Re: Add to text field and submit a form when a button is pressed

Set the text in a variable and keep the default property of the label to this variable.

Something like:

UpdateContext({textVar:"Pending"});SubmitForm(EditFormSave)

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

View solution in original post

Highlighted
Super User
Super User

Re: Add to text field and submit a form when a button is pressed

Also if Pending is a value of an Option Set you will have to reference it a bit differently.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com
Highlighted
Super User
Super User

Re: Add to text field and submit a form when a button is pressed

Set a variable on the SubmitButton : Set(MyText,"Pending");
SubmitForm(EditFormSave)

Then in the default of the textbox put the variable name: MyText
Highlighted
Advocate I
Advocate I

Re: Add to text field and submit a form when a button is pressed

Your solution did work for adding text when a button is pressed @PowerAddict . However, now I realized that I will need a way for the text to disappear when a new form is created. 

 

I am trying to create a save and submit buttons for my app my using a column named "Status". My plan was to insert "Pending" when the save button is pressed and "submitted" when the submit button is pressed.

Highlighted
Super User
Super User

Re: Add to text field and submit a form when a button is pressed

If you simply want your text to disappear when you are creating a new record, set the Default property of the label to:
If(FormName.Mode = FormMode.Edit, "Pending", Parent.Default)

The second part of your question: IS the only remaining part where you want to set the value to Submitted when the Submit button is pressed? Is this also in the same label that we have been referencing here?

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com
Highlighted
Advocate I
Advocate I

Re: Add to text field and submit a form when a button is pressed

I solved the problem of the text not disappearing by hiding that data card on the edit screen, since the user will not need to see it. Thank you for your help! @PowerAddict 

Highlighted
Super User
Super User

Re: Add to text field and submit a form when a button is pressed

Glad I could help! Good luck with the rest of the app! Feel free to reach out in case of any questions!

Thanks!
Hardit Bhatia
https://thepoweraddict.com

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 (6,245)