Custom List Forms and Redirecting after Update
// July 29th, 2008 // Sharepoint
One of my clients required a custom edit form for their editing screen where it would show certain fields and then redirect to a new page after the OK button was clicked. I had done this before at another client except i’d never found a way to actually redirect the page after the save. Here is an article on how to do that to.
1. In Sharepoint Designer take your EditForm.aspx and copy it.
2. Rename it
3. Open this new form and click on the PlaceHolderMain (leave your ListFormWebPart on the page)
4. In the ListFormWebPart scroll down the properties in the xml which describes the webpart and change
4. Click on Insert->Sharepoint Controls->Custom List Form
5. Choose the appropriate List and select Edit Form
6. Sharepoint generates the form for you.
To customize the save button, find the following control on the page Sharepoint:SaveButton
1. Delete the SaveButton
2. Add
input type="button" value="Save" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={}')}"
instead
3. This button allows the form to be saved and redirects to back to that page. See this article for more info
Hope it helps!
UPDATE:
If you wish to update after redirecting this is how i did it:
add in
ParameterBinding Name=”Source” Location=”QueryString(Source)”
to your paramterbindings list then add
xsl:param name=”Source”>0 /xsl:param>
xsl:variable name=”RedirectLoc”> xsl:value-of select=”$Source”/> /xsl:variable>
to your stylesheet
then the button should be:
input type=”button” value=”Save” name=”btnTopSave” onclick=”javascript: {ddwrt:GenFireServerEvent(concat(‘__commit;__redirect={‘,$RedirectLoc,’}'))}”/>

Hi when Im being redirected to the source I get a page error.
I checked the url and the dashes (-) in the source url are beign replaced with %2D.
any ideas?
Cheers
Great post, worked like a charm!
Hi
How can I redirect with custom values ? like CustomNewform.aspx?Title=FormFieldtitle so on the other page i will get the formfieldtitle from the previous one
Cheers
Hi,
I am Getting a page error…..Object Required
error at lin 533 char 8..
Any help..much appreciated..
Regards,
C
Works beautifully. Thanks.
For those getting page errors: check the syntax carefully. All those open and closed brackets and parenthesis got me at first.
Is it a good choice to use this tool?: Kaldeera Advanced Forms (http://www.kaldeera.com/en-US/products/AdvancedForms/Pages/default.aspx)
Thanx in advance
Thanks a lot.
This solution work fine in my case
when i do that it works fine but i like my edit form set instead of old edit form this means every link to edit form in every where redirect to my custom edit form: i change this:
right click on list in designer>properties>supporting file>edit Item form (change to my form)
but it does not work is any one can change it?
nice! Questions, I added a custom button to a customized newform. the button opens a second aspx pages for a lookup and then returns a value to a set field in the form. on the way back it works great.. but how can I parameterize my onclick url. Seems attempts to do xsl value-of result in Error: The character < cannot be used in ana attribute.
onclientclick="javascript:PS=window.open('https://site/PS.aspx?search=' ‘,’PS’,'width=800,height=600,scrollbars=1′);PS.focus()” />
I tried {@whatever} and got nothing.
Do I have to trap the onclick in javascript block outside of the inline markup and look up the field value?
Thanks.
In IE i get page errors but it works in Firefox.
Going to try window.location
good post got me closer. I really like that you gave the full button syntax for us newbies.
One issue – breaks the auto required field validation on dropdowns – still looking for a solution
it worked fine for me but I;ve found a problem.
I’ve inserted a validation formula in the E-mail Address field. The button is redirecting me to my ‘form submitted successfully’ page in spite of the fact that the data in the field doesn’t pass the validation. Could someone help me please ?
Thanks in advance
thanks it works great !
thanks, you are a life saver.
[...] Custom List Forms and Redirecting after Update | The Sydney Sharepoint Developer, Trainer and Consul… [...]