Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

This is in Sharepoint 2007 -- Designer

I have written a Form Action button and it has the following Code:

<input type="button" value="Add List Item" name="BtnSave" onlick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect{../../site/newItemAdded.aspx}')}" />

I've seen this solution a couple times on the web but doing this does not redirect the user at all. It does hit the __commit portion and saves the new list item, but it just posts itself back to the main form and does not redirect.

Any guidance would be great on how to get it to redirect correctly. I have written the above button by hand and by using the Form Action Button in Designer, neither with successful results.

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

Robert...

This time, dont use relative URLs, just add absolute URL (the entrie path of the page) eg.

<input type="button" value="Add List Item" name="BtnSave" onlick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect{http://<server>/sites/<site name>/Pages/<page name>.aspx}')}" />

It should work, cheers

share|improve this answer
    
This ended up working. A co-worker came up with the idea to use some xsl as well to grab the beginning of the URL (in a server variable) and use that beginning substring in order to put in what I wanted. Thanks! –  Robert Nov 14 '11 at 12:34
add comment

I don't know if you resolved the problem. But I had the same problem and I resolved only by putting the page that I want to go to like this:

{ddwrt:GenFireServerEvent('__commit;__redirect={default.aspx}')}

In your case I guess you need write:

{ddwrt:GenFireServerEvent('__commit;__redirect{/newItemAdded.aspx}')}"

That is because sharepoint take the URL's root. And add automatically this: "../../site/". In your case you are adding twice for example: "../../site/../../site/newItemAdded.aspx"

share|improve this answer
add comment

try to insert after word *__redirect* symbol =.

__redirect={../../site/newItemAdded.aspx}

In my case without this "=" code does not work

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.