Please bear with me, I'm a newbie at this Umbraco malarkey. However, I am losing the will to live.
I've inherited a previously developed Umbraco system and have been quite happy doing changes in the CMS with xslt & macros and the like.
Our client has requested the following:
1. Provide a list of PDF documents to download (dead simple) 2. A form to capture a name, email & company (again dead simple - contour) 3. The ability to stop users from downloading the documents until the form has been filled in - I'm thinking cookie.
What I want to be able to do is this.
User clicks on link to the downloads section. Check to see if the cookie exists If cookie exists and is valid then send user to the download section If cookie does not exist/invalid send user to contour form Once completed set the cookie and redirect to downloads section If someone tries to go directly and the cookie is missing/invalid then we redirect to the download section.
Apologies for the delay. I thought I'd written a response.
The .submit of jQuery doesn't seem to be called when the form submits. I have a feeling that contour already add javascript to the submit event which is causing the jQuery to fail??
(I've created a template called "SubmitForm" that loads the jQuery from MS)
I've tried all sorts of combinations of form name to try and get this damn thing to work:
I tried your suggestion but it seems as though that code executes as soon as you click anything in the form - so I don't even have chance to fill in the textboxes.
The form submit button is rendered by the asp.net engine and gets called something silly "ctl001ctl001ctl001..." etc.
Am I the only person that has this need?
Thanks again, David
PS. I added "return false" just as a test to see if that helped my cause
However, once I've completed the form I want to be redirected to the QueryString provided. So when I get the form to say thanks for submitting I check in jQuery the cookie existance and then redirect using document.location...
Store Cookie on Submit
Please bear with me, I'm a newbie at this Umbraco malarkey. However, I am losing the will to live.
I've inherited a previously developed Umbraco system and have been quite happy doing changes in the CMS with xslt & macros and the like.
Our client has requested the following:
1. Provide a list of PDF documents to download (dead simple)
2. A form to capture a name, email & company (again dead simple - contour)
3. The ability to stop users from downloading the documents until the form has been filled in - I'm thinking cookie.
What I want to be able to do is this.
User clicks on link to the downloads section.
Check to see if the cookie exists
If cookie exists and is valid then send user to the download section
If cookie does not exist/invalid send user to contour form
Once completed set the cookie and redirect to downloads section
If someone tries to go directly and the cookie is missing/invalid then we redirect to the download section.
Why can't I set a cookie in the Submit workflow?
Thanks
Disgruntled David
Hi David,
You could set the cookie using jQuery on the submission of the form.
http://www.electrictoolbox.com/jquery-cookies/
Thanks
Tom
Apologies for the delay. I thought I'd written a response.
The .submit of jQuery doesn't seem to be called when the form submits. I have a feeling that contour already add javascript to the submit event which is causing the jQuery to fail??
(I've created a template called "SubmitForm" that loads the jQuery from MS)
I've tried all sorts of combinations of form name to try and get this damn thing to work:
I've tried "aspnetForm" etc etc.
Am I being thick?
Thanks
David
Hi David,
Try doing it on the click of the button instead of the submit (not tested fully)
This should allow the adding of the cookie and then the submission of the form as the return false will stop this.
Hope this helps
Tom
Hi Tom,
Sorry for the delay.
I tried your suggestion but it seems as though that code executes as soon as you click anything in the form - so I don't even have chance to fill in the textboxes.
The form submit button is rendered by the asp.net engine and gets called something silly "ctl001ctl001ctl001..." etc.
Am I the only person that has this need?
Thanks again, David
PS. I added "return false" just as a test to see if that helped my cause
Hi Tom,
You set me on the right track!! This seems to do the trick....
Comment author was deleted
Hi David,
You can also use the Contour event model to set a cookie on submit (trough c# code not jquery).
There is an example here: http://www.nibble.be/?p=81 (step 3)
Hi Tim,
Thanks for that, again that seems to work also :)
However, once I've completed the form I want to be redirected to the QueryString provided. So when I get the form to say thanks for submitting I check in jQuery the cookie existance and then redirect using document.location...
This still feels like a Fudge to me.
Thanks
David
is working on a reply...