Do You have working methods to redirect in SharePoint Online now? I'm trying to save item and then open Edit Form after clicking 'Save'. There were methods to do it before: link 1 link 2. But it redirects to default list view after save. Sharepoint redirect Newform.aspx to Editform.aspx after the item has been added. I have created a custom field type which upload images to picture library.
![]() ![]()
Today I want to talk about something extremely simple but I find is either not known or overlooked. In PowerApps, you use Form Controls to enter and edit data. These Form Controls have different Modes:
New – To add a New Item to your DataSource
Edit – To Edit an Existing Item in your DataSource Display – To View data in your DataSource
I find a lot of people creating multiple Form Controls for each of these modes. While that might make sense if the data you want to show between the different modes is drastically different, most times I find that it’s the same. If that’s the case, then why not use one form control for all 3 modes? Thankfully you can do that fairly easily with the following functions:
EditForm(“Name of your Form Control”)
NewForm(“Name of your Form Control”) ViewForm(“Name of your Form Control”)
You can call each of these functions and pass in the name of your Form Control to change the Mode of the control.
Here’s an example of how I used this in one of my PowerApps. I have a Project Initiation Form landing screen with an icon to add a new item and a Gallery control to edit an existing item. I used a Global Variable called “varMode” and set it to “Edit” when the Gallery Control icon is selected. I set that same Global Variable to “New” when the new icon was selected.
![]()
Then, I go to the screen where my Form Control is and added the following function to the “OnVisible” property:
If(varMode = “Edit”, EditForm(NewSimpleForm),NewForm(NewSimpleForm))
That’s all I needed to do to be able to use the same Form Control for both the New and Edit form.
I also made a short video which walks you through how to implement this:
Share
In this article I will demonstrate how to handle a form submission event with Forms Designer tool and particularly how to redirect the user to the specific page.
Many of our clients request an option to redirect the user to the ‘Thank you’ page after creating a new item. Just paste the following script into the Forms Designer JavaScript editor and your users will be redirected to ‘/SitePages/ThankYou.aspx’ page on the submission and to ‘/SitePages/Cancel.aspx’ on the cancellation:
Ok, another popular request is to allow users to add multiple items without closing a new form. We suggest to confirm with the user whether they want to add a new item after the submission of the current one. If they want so, the new form will be refreshed. Otherwise the user will be redirected to the ‘Thank you’ page. I have extended the previous script with the described functionality:
As you can see it is very easy to extend functionality of your form with Forms Designer JavaScript framework. You can find the full description of fd-object on the official website.
Recommend this:
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |