cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FrostedFlake
Resolver I
Resolver I

Set property of another field when OnSubmit is performed

I want to change the "Text" property of a Textfield when i submit my form. How can i assign a value to a Textfield out of the OnSubmit property?

In C# i would just assign it like this:

Class.Text = "XYZ"

 

Thanks!

3 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User III
Super User III

@FrostedFlake 

PowerApps uses values by reference not by assignment.  

I am not sure what the OnSubmit property is that you refer to.  I am assuming you mean the OnSuccess of your form.

If so, you can set a variable in your OnSuccess action.  Either a screen variable - UpdateContext({someVar:"SomeVal"}) or a global app variable - Set(someVar, "SameVal")

 

You can then set the Text property of your control (presumably a label) to someVar

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

GarethPrisk
Super User II
Super User II

To expand on @RandyHayes' response, you may be looking to change/set the Update property of the Data Card within the form.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-cards#information-flowing-...

In a nutshell:

  • Forms are built-in controls which allow to quickly/easily setup a data source and inputs (fields)
  • For each field, power apps inserts a Data Card
    • The Data Card is locked by default
    • It has a few controls (based on data type), which are included with the Data Card
    • The Data Card itself has a few properties; including the Update property
      • This is what is actually sent to the DB when you SubmitForm

You can unlock the Data Card and update the individual controls, and the properties of the Data Card itself. In your example, you'd be looking to

  1. Use @RandyHayes suggestion of a local variable
  2. Set the Default field of the control, with that variable (this is what the Update property of the data card references)
  3. OR set the Update property equal to the variable



https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-forms

 

View solution in original post

FrostedFlake
Resolver I
Resolver I

3 REPLIES 3
RandyHayes
Super User III
Super User III

@FrostedFlake 

PowerApps uses values by reference not by assignment.  

I am not sure what the OnSubmit property is that you refer to.  I am assuming you mean the OnSuccess of your form.

If so, you can set a variable in your OnSuccess action.  Either a screen variable - UpdateContext({someVar:"SomeVal"}) or a global app variable - Set(someVar, "SameVal")

 

You can then set the Text property of your control (presumably a label) to someVar

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

GarethPrisk
Super User II
Super User II

To expand on @RandyHayes' response, you may be looking to change/set the Update property of the Data Card within the form.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-cards#information-flowing-...

In a nutshell:

  • Forms are built-in controls which allow to quickly/easily setup a data source and inputs (fields)
  • For each field, power apps inserts a Data Card
    • The Data Card is locked by default
    • It has a few controls (based on data type), which are included with the Data Card
    • The Data Card itself has a few properties; including the Update property
      • This is what is actually sent to the DB when you SubmitForm

You can unlock the Data Card and update the individual controls, and the properties of the Data Card itself. In your example, you'd be looking to

  1. Use @RandyHayes suggestion of a local variable
  2. Set the Default field of the control, with that variable (this is what the Update property of the data card references)
  3. OR set the Update property equal to the variable



https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-forms

 

View solution in original post

FrostedFlake
Resolver I
Resolver I

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

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