Need help with XSLT for the first child node of the current node
I am configuring a Contour form and after the user has submitted the form I want to redirect them to the first child node of the page on which the form is placed.
But my XSLT is very rusty, I have last used it 7 years ago and never with Umbraco. Can someone point me in the right direction?
Yeah, it has a redirect to page option, you can pick a node or enter XSLT. Because I need to reuse the form across multiple sites, I want the behavior to be: redirect to first child node. And I need to use the XSLT option for that.
And I'd prefer a redirect, because that's easiest to measure as a goal conversion in Google Analytics.
I'm not sure what the implied context is when you enter an XPath expression for Contour, but presuming it recognizes the standard $currentPage variable, then this should work:
$currentPage/*[@isDoc][1]
...which basically just points to the first child document node under the current page. Instead of the "*" you can of course specify any doctype, in which case the [@isDoc] test becomes superfluous, e.g.:
Thanks for your suggestion. Unfortunately, anything I enter into the XPath field results in an exception ("input string was not in a correct format") on the website when submitting the form. I have submitted that to support, when it is resolved I will try your XPath.
Hmm, I can't find any documentation on the redirect-to-XPath functionality, but perhaps the $currentPage variable is unnecessary. How about simply this:
Need help with XSLT for the first child node of the current node
I am configuring a Contour form and after the user has submitted the form I want to redirect them to the first child node of the page on which the form is placed.
But my XSLT is very rusty, I have last used it 7 years ago and never with Umbraco. Can someone point me in the right direction?
Thank you!
Hi Michiel,
Doesn't Contour have a behavior like that? I seem to recall a "Send to page" property on the "Settings" tab of a Form...
Otherwise, do you want to perform a browser redirect or just render the contents of the child page?
/Chriztian
Yeah, it has a redirect to page option, you can pick a node or enter XSLT. Because I need to reuse the form across multiple sites, I want the behavior to be: redirect to first child node. And I need to use the XSLT option for that.
And I'd prefer a redirect, because that's easiest to measure as a goal conversion in Google Analytics.
Hi Michiel,
I'm not sure what the implied context is when you enter an XPath expression for Contour, but presuming it recognizes the standard $currentPage variable, then this should work:
...which basically just points to the first child document node under the current page. Instead of the "*" you can of course specify any doctype, in which case the [@isDoc] test becomes superfluous, e.g.:
Will that work?
Hi Dan,
Thanks for your suggestion. Unfortunately, anything I enter into the XPath field results in an exception ("input string was not in a correct format") on the website when submitting the form. I have submitted that to support, when it is resolved I will try your XPath.
Thanks!
Hmm, I can't find any documentation on the redirect-to-XPath functionality, but perhaps the $currentPage variable is unnecessary. How about simply this:
Will that work?
Not a single XPath query I have tried (and i tried lots) works, they all result in the same exception when submitting the form.
is working on a reply...