I have a site where I need to have users check an "I accept" box, before hitting submit. Provided the box was checked, it will send the user to a specified page.
I'm trying to modify the runway contact form as my starting point since it's the only .net control macro I've used, but I'm stuck on how to get it to take the user to a new page vs. send the email.
I do have access to some .net developers, but nobody who has developed for umbraco. If anyone could point me in the right direction on how to achieve this (or what to ask them), that would be fantastic.
I don't know how the runway package handles this, but it should eventually do a Page.IsValid after the button click event. You could check for chechbox1.Checked == true together with Page.IsValid.
If they are both true then you can send the email and after that do a response.redirect.
Thanks very much - from what I can tell it does indeed use a Page.IsValid function at the end, which contains the sendmail stuff. I don't actuyally need to send the mail, so I could in theory replace the sendmail stuff with a response.redirect?
2) In the form, down near the submit button, add this:
<asp:CheckBox ID="CheckBox1" runat="server" /> By checking this check box, I agree that I have read and understand the "<a href="javascript: void(0)" onclick="window.open('/consent-for-exercise.aspx','windowname1', 'width=500, height=500,scrollbars=yes'); return false;">Consent for Exercise</a>" information and voluntarily consent to participate in programs. (Click the link to open the terms in a new window.)
<asp:CustomValidator ID="valTandCs" ClientValidationFunction="ValidateCheckBox1" runat="server" ErrorMessage="Please check the box to indicate you agree to the terms."></asp:CustomValidator>
That's a huge help, thank you. One more question - if I set this up as a macro pointing to the ascx file, am I able to use a content picker to tell it which page to redirect to?
I'm not totally clear from the code snippets where I'd go about setting up how it points to a new page once sucessfully submitted.
Yes, you can pass macro parameters to your user control. Define your paramater (on the parameter tab), set it to content picker type. Add a public property to your user control with the same name as the alias of your newly defined parameter. umbraco will pass that value automagically. In your user control, you can use that value to redirect to the page you like.
Remember: if using a content picker, the public property should be an integer and umbraco will pass the id of the page, you'll need NiceUrl() to get the page url.
.net form control, redirect on form submission?
I have a site where I need to have users check an "I accept" box, before hitting submit. Provided the box was checked, it will send the user to a specified page.
I'm trying to modify the runway contact form as my starting point since it's the only .net control macro I've used, but I'm stuck on how to get it to take the user to a new page vs. send the email.
I do have access to some .net developers, but nobody who has developed for umbraco. If anyone could point me in the right direction on how to achieve this (or what to ask them), that would be fantastic.
I don't know how the runway package handles this, but it should eventually do a Page.IsValid after the button click event. You could check for chechbox1.Checked == true together with Page.IsValid.
If they are both true then you can send the email and after that do a response.redirect.
Thanks very much - from what I can tell it does indeed use a Page.IsValid function at the end, which contains the sendmail stuff. I don't actuyally need to send the mail, so I could in theory replace the sendmail stuff with a response.redirect?
To force users to accept the terms, here is what I do.
1) at the top of the .ascx control file, add this:
2) In the form, down near the submit button, add this:
That's a huge help, thank you. One more question - if I set this up as a macro pointing to the ascx file, am I able to use a content picker to tell it which page to redirect to?
I'm not totally clear from the code snippets where I'd go about setting up how it points to a new page once sucessfully submitted.
Hi aaronb,
Yes, you can pass macro parameters to your user control. Define your paramater (on the parameter tab), set it to content picker type. Add a public property to your user control with the same name as the alias of your newly defined parameter. umbraco will pass that value automagically. In your user control, you can use that value to redirect to the page you like.
Remember: if using a content picker, the public property should be an integer and umbraco will pass the id of the page, you'll need NiceUrl() to get the page url.
Cheers,
/Dirk
is working on a reply...