0
我想限制magento后端自定义变量的文本字段类型为int。似乎没有任何类型的资格。最接近的是文本。我想通过使用前端类型和模型的组合来限制;然而,它看起来像很多工作,只是将类型限制为int。有没有更好的解决方案?Magento前端类型限制
我想限制magento后端自定义变量的文本字段类型为int。似乎没有任何类型的资格。最接近的是文本。我想通过使用前端类型和模型的组合来限制;然而,它看起来像很多工作,只是将类型限制为int。有没有更好的解决方案?Magento前端类型限制
我找到了答案。它是在字段定义中添加一个验证标签。 验证标记可以验证所有类型的值。在我的情况是:
<validate>validate-digits</validate>
完整的解决方案是:
<fields>
<field_name translate="label">
<label>Field Label</label>
<frontend_type>text</frontend_type>
<validate>validate-digits</validate>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</field_name>
</fields>