By: Omar Stewart
This is a quick tip that will help you when creating data view forms. Data View Forms are a great way to quickly provide an a way for users to add data to a sharepoint list. One of the issues that may arise is that when a user clicks submit, The form has a default location where it will direct the user to. There are times when this can be a problem. Sometimes you want a user to fill out a form, click submit, then be taken back to the homepage. This is easy to achieve using form actions.
Let's take a look at an example.
First we'll create our basic list.
Now that we have a list, lets head to SharePoint Designer and give users a form to input entries into the list.
Once you have SharePoint Designer open, go ahead and open up your site, then click File >> More Pages>> ASPX Page.
(Edit in advanced mode)
On the newly created page, click INSERT >> Select the Data View DROPDOWN >> Then click Click Empty Data View.
Once the empty dataview is in place, click on it to select a source.
Once you select a source, you should see your fields appear on the right side panelof the window. Control Click the fields you would like in your form, then click Insert Selected Fields as >> New Item Form.
You now have a form ready to be published. This form will automatically populate the SharePoint list. Feel free to design the form as you please.
Users can now access this form and submit data to that list. Now lets say you would like your users to go back to your site landing page after submitting an item.
Open up the Source View in Designer, look for the <Input> button with a value of "Save". If we look at the OnClick event , you'll see the JavaSCipt call that the form uses to submit to the list.
This is where we can modify the action of the submit action.
Lets invoke a redirect after the commit action.
Now when a user submits the form, the data will be submitted to the list, then they will be taken to the specified URL !
Note: this could also be done by using the form actions menu.
By: Omar Stewart