我有这个架构:
Users = new Meteor.Collection('users', {
schema: {
firstname: {
type: String,
label: "First name",
max:50
},
lastname: {
type: String,
label: "Last name",
max:50
},
email: {
type: String,
label: "E-mail",
regEx: SimpleSchema.RegEx.Email,
optional: false,
max:50
},
tel: {
type: String,
label: "Phone",
optional: false,
max:50
},
zip: {
type: String,
label: "Zip code",
optional: false,
regEx: /^[0-9]{5}$/,
max:50
},
city: {
type: String,
label: "City",
optional: false,
max:50
},
}
});
在我的模板中,我像这样使用 Autoform:
<template name="userSubmit">
{{> quickForm collection="Users" id="insertUserForm" type="insert" validation="blur"}}
</template>
我想自定义邮政编码的错误消息。而不是“不符合正则表达式”,我想有:“你的邮政编码只能是数字,应该有 5 个字符”
我怎样才能做到这一点?