嗨,我在db中有一个模板存储:如下所示:
<p>Dear [[OWNER_NAME]],</p>
<p><br />
We are thanks put [[LOCATION_NAME]] to you.</p>
<p>It is very early stagesyou know.</p>
<p>If anything comes of it, we will be in contact immediately with a further email.</p>
我有一个表单,我需要填写必填字段。我知道要使用以下代码来验证该字段是否为空:
<?php
if (!empty($_POST['client_name'])) {
echo '<p style="color:red;">'"Client Name is required!"'</p>';
}
?>
我的问题是,如何在表单页面上显示错误消息,保存表单中已经输入的所有数据。示例:我填写了表单上的所有15个字段,但不包括必填字段。当我点击提交按钮时,如果必填字段为空,我希望停留在该表
在simple_form初始化器中有下面这一行
# How the label text should be generated altogether with the required text.
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
我删除了注释并将其更改为
# How the label text should be generated altogether with the required text.
conf