我正在Azure上运行OctoberCMS,并且试图在10月使用“ Magic Forms”插件。我正在使用通用表单,并且已成功提交该表单并将其显示在后端。
我的问题是,我想在提交表单时发送电子邮件通知,我已经设置了stmp,并且测试消息正确发送,但是提交后什么也没有发生。
我的另一个问题是验证或JsOnSuccess均未触发。
我已经为name字段设置了自己的规则和规则消息,但没有任何更改。
我已经尝试对所有电子邮件详细信息进行硬编码,即使测试消息有效,也仍然没有发送电子邮件。
[viewBag]
snippetCode = "formAccountingServices"
snippetName = "Form Accounting Services"
[emptyForm formAccountingServices]
group = "Accounting-Services"
rules[name] = "required"
rules[email] = "required|email"
rules[phone] = "required"
rules[service] = "required"
rules[message] = "required"
messages_success = "Your form was successfully submitted"
messages_errors = "There were errors with your submission"
mail_enabled = 1
mail_subject = "Test Subject"
mail_recipients[] = "myemail@gmail.ie"
mail_replyto = "emailFromForm@gmail.com"
reset_form = 1
redirect = "https://myHomeUrl.com"
inline_errors = "display"
js_on_success = "window.location.href = 'http://stackoverflow.com;'"
sanitize_data = "disabled"
anonymize_ip = "disabled"
recaptcha_theme = "light"
recaptcha_type = "image"
recaptcha_size = "normal"
==
<form data-request="{{ formAccountingServices}}::onFormSubmit">
{{ form_token() }}
<div id="{{ formAccountingServices }}_forms_flash"></div>
<div class="form-group">
<label for="name">Name:</label>
<input type="text" id="name" name="name" class="form-control">
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="text" id="email" name="email" class="form-control">
</div>
<div class="form-group">
<label for="phone">Phone:</label>
<input type="text" id="phone" name="phone" class="form-control">
</div>
<div class="form-group">
<label for="service">Service of interest</label>
<select name="service" id="service" class="form-control">
<option value="Accounting Services">Accounting Services</option>
<option value="Legal Services">Legal Services</option>
</select>
</div>
<div class="form-group">
<label for="message">Message</label>
<textarea id="message" name="message" rows="8" cols="80"></textarea>
</div>
<button id="simpleContactSubmitButton" type="submit" class="btn btn-default">Submit</button>
</form>
答案 0 :(得分:1)
您是否正在使用自定义主题? Magic Form明确使用ajax。确保您在{%framework extras%}之前加载了jquery,但我不记得它是否需要{%scripts%}。
为此寻求帮助的更好的地方也可能是插件https://github.com/skydiver/october-plugin-forms的github。
答案 1 :(得分:0)
我有解决办法了!
只需像下面这样放置由Magic Forms插件生成的设置:
[viewBag]
[genericForm contactForm]
rules[name] = "required"
rules[email] = "required|email"
rules[message] = "required"
rules[tel] = "required".... etc
==
进入部分注入的页面,像这样{%部分'sections / contact'%} 然后,您将可以将组件“ contactForm”(在我的情况下,当然是这样)注入部分“部分/联系人”中,例如{%component“ contactForm”%}
请记住在jQuery scrtipt之前将{%framework extras%}包含到布局中以启用ajax处理程序。
就是这样!