Specifying the workflow setting "Where to save" when using RestContour?
Hi!
I'm using Cultiv RestContour on an Umbraco 4.11.4 site and I have the basic functionality up and running. The data from my form is saved in Contour using AJAX. I also supply the parameter "nodeId" from the page where the form is currently displayed using a hidden form field, like this:
This also works since I can see the ID of the page from which when I look at the entries in Contour. But here's the problem: I'm using the XSLT-path option for the "Where to save" setting in Contour to make it save the data from the form as an Umbraco node/page. The XSLT I'm using looks like this:
This XSLT works when I run the Contour form as a regular form (not using RestContour) but something breaks when you submit the data using RestContour. I'm not surprised since it's a whole different way of submitting form data and you lose the context in which the form normally exists. So I'm thinking the $currentPage doesn't make much sense when the form data is submitted using RestContour.
A long shot was adding the nodeId parameter to see if it would affect the workflow but unfortunatelly it didn't.
Can you think of a way that I can make the CultivRest form submission context aware so the workflow will know where it should create the new node? The other option would be to create an individual form for each page where it's used but we're talking 15-20 pages here so that would be very tedious to set up and difficult to manage (settings for each form etc).
You can set a dynamic parameter in the form of a node ID as the parameter for the workflow setting "Where to save", which makes sense. So, using the Umbraco Contour syntax and following the example code above, you add [@nodeId] as the "Where to save" parameter and the page will be saved as a subpage to the node where the form is located.
In my case I need the page to be saved to a subpage to the page where the form is so I wrote a simple XSLT that I use to generate the hidden field and set its value.
This is inserted as a macro in the form, a hidden field is inserted with the node ID to subpage where I want to save the page generated by the workflow.
Specifying the workflow setting "Where to save" when using RestContour?
Hi!
I'm using Cultiv RestContour on an Umbraco 4.11.4 site and I have the basic functionality up and running. The data from my form is saved in Contour using AJAX. I also supply the parameter "nodeId" from the page where the form is currently displayed using a hidden form field, like this:
This also works since I can see the ID of the page from which when I look at the entries in Contour. But here's the problem: I'm using the XSLT-path option for the "Where to save" setting in Contour to make it save the data from the form as an Umbraco node/page. The XSLT I'm using looks like this:
This XSLT works when I run the Contour form as a regular form (not using RestContour) but something breaks when you submit the data using RestContour. I'm not surprised since it's a whole different way of submitting form data and you lose the context in which the form normally exists. So I'm thinking the $currentPage doesn't make much sense when the form data is submitted using RestContour.
A long shot was adding the nodeId parameter to see if it would affect the workflow but unfortunatelly it didn't.
Can you think of a way that I can make the CultivRest form submission context aware so the workflow will know where it should create the new node? The other option would be to create an individual form for each page where it's used but we're talking 15-20 pages here so that would be very tedious to set up and difficult to manage (settings for each form etc).
Thanks in advance!
/Thomas Kahn
I have found a solution.
You can set a dynamic parameter in the form of a node ID as the parameter for the workflow setting "Where to save", which makes sense. So, using the Umbraco Contour syntax and following the example code above, you add [@nodeId] as the "Where to save" parameter and the page will be saved as a subpage to the node where the form is located.
In my case I need the page to be saved to a subpage to the page where the form is so I wrote a simple XSLT that I use to generate the hidden field and set its value.
This is inserted as a macro in the form, a hidden field is inserted with the node ID to subpage where I want to save the page generated by the workflow.
/Thomas
is working on a reply...