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

Using variable as Parameter for SubmitForm

Hello all,

 

I might have this completely wrong, but at this point it seems the simplest solution for me, so if there is a better way of doing this, let me know.

What am I up to?

 

I have a Sharepoint list as data source and am writing an app as a front end for data entry. Since the list will eventually get quite column-rich I plan to split up the data entry over multiple edit forms. Using the method of splitting into multiple screens as suggested by Randy Hayes implies sequential data entry and this is not necessarily working for the intended use.

Therefore I started with two containers, one holding buttons to select the edit form and one that holds the actual form.

 

What I would like to have is on submit button for each form. The way the UI is designed the best spot for that would be in outside the container in the header together with a few other general use icons.

 

What I did with this button is:

OnSelect: SubmitForm(cvar_current_form) with cvar_current_form set to the name of the selected form by the OnSelect of the button selecting the form:

UpdateContext({
cvar_referral_vis: true,
cvar_staff_vis: false,
cvar_current_form: "FormReferral"
});

The *_vis variables set the visibilities of the individual forms. As it will most likely be only 4 or 5 forms, I think I can handle this clumsy method.

 

The button OnSelect SubmitForm(cvar_current_form) results in an error (The formula expects an editable form as its input).

 

Any help appreciated.

Thanks ina dvance

Hansjoerg

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @ha_wai ,'

You cannot refer to a Form as a Variable - you would have to hard-code it

Switch(
   cvar_current_form,
   "FormReferral",
   SubmitForm(FormReferral),
   "FormName2",
   SubmitForm(FormName2),
    . . . . 
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @ha_wai ,'

You cannot refer to a Form as a Variable - you would have to hard-code it

Switch(
   cvar_current_form,
   "FormReferral",
   SubmitForm(FormReferral),
   "FormName2",
   SubmitForm(FormName2),
    . . . . 
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

Thanks @WarrenBelz ,

 

would have been too easy;)

 

But the switch work around should be manageable for the first version. Later I will probably be able to figure out how to apply @RandyHayes method to forms that are spread out over a container instead of over screens.

RandyHayes
Super User
Super User

@ha_wai 

Yes, you can apply the method demonstrated in my video for splitting forms to any place that you actually split a form (i.e. containers).

 

_____________________________________________________________________________________
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

Really want to show your appreciation? Buy Me A Cup Of Coffee!
ha_wai
Helper I
Helper I

@RandyHayes 

Thanks for confirming my suspicions.

 

One more questions, if you don't mind:

I don't want the form that is ultimately used to submit everything to display everything. Do I need to have all the datacards on this form and just turn visibility off or can I remove the the ones that are already dealt with in other forms?

 

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,695)