Posted on 07/01/2016 08:49:02
Hmm I'm having something weird. The email suddenly didn't get sent anymore even though we didn't touch the template. I tried some stuff but nothing seems to work. The form is sending correctly and I'm redirected to the right page but it doesn't actually do anything. I get no javascript error
My template :
@inherits RazorTemplateBase<RazorTemplateModel<Template>>
@using System;
@using System.Web;
@using Dynamicweb.Rendering;
@{
string formCssClass = GetString("Form.CssClass");
string formSystemFields = GetString("Form.SystemFields");
string formId = GetString("Form.HtmlId");
string formOnSubmit = GetString("Form.OnSubmit");
}
<script type="text/javascript">
function_@formOnSubmit.Replace("return s(this);", string.Empty).Replace("return true", string.Empty)
function submitNewsletter(form) {
Cookies.set('@Pageview.Area.Item["NewsletterCookieName"]', '1', { path: '/', expires: 14 });
alert('@Translate("NewsletterConfirmation", "Thanks for subscribing !")');
function_s(form);
return true;
}
</script>
<form method="post"
enctype="multipart/form-data"
class="@formCssClass"
id="@formId"
onsubmit="return submitNewsletter(this);">
@formSystemFields
<span class="newsletter-text"><h3>@Translate("NewsletterText", "Subscribe to our newsletter")</h3></span>
<input type="text" id="Name" name="Name" placeholder='@Translate("NewsletterNamePlaceHolder", "Name")' required class="form-control" />
<input type="email" id="Email" name="Email" placeholder='@Translate("NewsletterEmailPlaceHolder", "Email")' required class="form-control" />
<input type="submit" id="Send" name="Send" value='@Translate("NewsletterSendButtonText", "Send")' class="btn btn-default" />
</form>
What it looks like in the html :
<script type="text/javascript">
function_s=function(e){e.elements['FormCH1_h'].value='db94fed3609a6d58c4124176c8162f97';e.elements['_sys_to_email'].value='';e.setAttribute('action', 'Default.aspx?ID=132');};
function submitNewsletter(form) {
Cookies.set('newslettershown', '1', { path: '/', expires: 14 });
alert('Thanks for subscribing !');
function_s(form);
return true;
}
</script>
<form method="post" enctype="multipart/form-data" class="" id="dw-form-13" onsubmit="return submitNewsletter(this);">
<input name="FormPID" value="1888" type="hidden">
<input name="FormID" value="13" type="hidden">
<input name="cmd" value="save" type="hidden">
<input name="_sys_to_email" value="bot@dynamicweb.com" type="hidden">
<input name="FormCH1_h" value="" type="hidden">
<input name="FormCH1_f" value="9becc1c37e19da00f0e84f938c65e0f6" type="hidden">
<input name="FormCH1_s" value="0dd65e8dd4cfe9e0837c18620877ea83" type="hidden">
<input name="FormCH1_i" value="e925e97e7aafb9df31a599b175bc5228" type="hidden">
<span class="newsletter-text"><h3>Gå ikke glip af
vores nyhedsbreve</h3></span>
<input id="Name" name="Name" placeholder="Navn" required="" class="form-control" type="text">
<input id="Email" name="Email" placeholder="Email" required="" class="form-control" type="email">
<input id="Send" name="Send" value="Send" class="btn btn-default" type="submit">
</form>
And the content of the post request :
FormPID |
1888 |
FormID |
13 |
cmd |
save |
_sys_to_email |
|
FormCH1_h |
86c564337500a3e1dbaddbd1e3e0b201 |
FormCH1_f |
9becc1c37e19da00f0e84f938c65e0f6 |
FormCH1_s |
83ca4ab11b1bd099b8af6347d649a5ac |
FormCH1_i |
e925e97e7aafb9df31a599b175bc5228 |
Name |
test |
Email |
gdctest@yopmail.com |
Send |
Send |