Showing posts with label boomerang link. Show all posts
Showing posts with label boomerang link. Show all posts

Sharepoint and redirects.

What I have learnt - using the source in the url is all very well but I have not found it to be universally useable SO.
If you just want to submit a form and have it wizz off to somewhere other than the all items view then you want somethig like this

<input type="button" value="Form Action" name="btnFormAction" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={your address goes here with no quotes}')}" /&gp;

However if you want the redirect to be dynamic - and of course that is what you want
then MR autosponge has the answer here

http://autosponge.spaces.live.com/blog/cns!D7F85948C20F0293!233.entry

However what this post doesn't say explicitly is what to do when you want to redirect to a child site that or to a child list so you need the ID of the item to generate the URL - here's what I used


<xsl:variable name="dvt_1_automode">0</xsl:variable>
<xsl:param name="ListItemId">


<xsl:variable name="rec"<>xsl:value-of select="@Title"></xsl:variable>
<xsl:variable name="RedirectLoc">https://blah/sites/isms/<xsl:value-of select="/dsQueryResponse/Rows/Row/@Title"></xsl:variable

or

<xsl:variable name="RedirectLoc">https://blah.com/auditrecnfollowups.aspx?recid=<xsl:value-of select="/dsQueryResponse/Rows/Row/@Title"/>%lt;/xsl:variable>


the xpath /dsquery/Rows/Row/@Title is the important bit that uniquely identifies the attribute. This cost me much swearing, the chief reason being that when the redirect url is wrong IN ANY WAY it just does nothing and gives you a 404 so the only way to test this is to have the $redirectloc redisplayed on the screen till its right.

Lists to xml

Amazing little trick for getting lists into xml and where ever your hearts desire after that!

http://www.sharepointblogs.com/dwise/archive/2008/01/10/accessing-sharepoint-list-data-as-xml.aspx

Creating simple forms

Assuming that your form needs are simple, why not use a list..create the columns or content types that support that holiday request , site request or what have you, in a list with the required fields.

Then link to the list but append
NewForm.aspx?
to the url of the link. This way when the user clicks the link they are taken immediately to a new form rather than having to navigate the list.

after
NewForm.aspx?source=
and then the address of the page that the link belongs on or to a page with a thank you message. This way when the user clicks OK, after finishing with their form they are taken to this page,rather than the all items view of the list they have just added to, this allows for a more friendly user experience. This source trick is what I call a boomerang link