我目前正在对针叶林的自定义实现,我注意到的是,即使我们在app/partials/custom-attributes/custom-attribute-value-edit.jade
置于一种模式,我们的自定义输入区如果输入没有按来ping错误不按照指定的模式如此大雅前端提交的自定义属性更改即使无效
input#custom-field-value(name="value", type="tel", pattern="^\\+\\d{1,3}\\s\\d{1,3}\\s\\d{3}\\s\\d{4}$", placeholder="format: +[country_code] [area_code] [xxx] [xxxx] (e.g: +1 234 567 8910)", value!="<%- value %>")
表格仍然提交给后端。虽然我确实看到一条表示模式不匹配的快速消息,但表单仍然提交。我得到了追查的过程中最远的是这个文件 app/coffee/modules/common/custom-field-values.coffee
有一部分没有用于处理提交
submit = debounce 2000, (event) =>
event.preventDefault()
form = $el.find("form").checksley()
return if not form.validate()
input = $el.find("input[name=value], textarea[name='value'], select[name='value']")
attributeValue.value = input.val()
if input.prop("type") == 'checkbox'
if input[0].checkValidity()
attributeValue.value = !!input.prop("checked")
但那是据我得到了。我的目标是不允许提交如果没有按照指定的模式输入验证问题,如输入发生。我使用的针叶林是3.0.0