浏览文章
文章信息
Magento2 system.xml验证字段必填|Magento2 system.xml required
12259
示例:
<field id="heartbeat_url" required="true" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" > <label>心跳URL</label> <comment>定期访问系统URL,用于网站的自动检测或者注册</comment> <validate>required-entry validate-digits</validate> </field>可用:
'required-entry' => 'This is a required field.' 'validate-number' => 'Please enter a valid number in this field.' 'validate-email' => 'Please enter a valid email address. For example johndoe@domain.com.' 'validate-date' => 'Please enter a valid date.' 'validate-select' => 'Please select an option.' 'validate-no-html-tags' => 'HTML tags are not allowed' 'validate-digits' => 'Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.' 'validate-url' => 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)' 'validate-not-negative-number' => 'Please enter a number 0 or greater in this field.' 'validate-zero-or-greater' => 'Please enter a number 0 or greater in this field.' 'validate-state' => 'Please select State/Province.' 'validate-cc-number' => 'Please enter a valid credit card number.' 'validate-data' => 'Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.'