I want to restrict the type of a text field for magento backend custom variable to int. There doesn't seems to be any type qualifying for it. The closest one is text. I was thinking of restricting by using a combination of frontend type and model; however it seems like a lot of work, just to restrict the type to int. Is there any better solution for the same?
I found the answer. It is to add a validate tag in the field definition. The validate tag can validate all kind of values. In my case it is:
<validate>validate-digits</validate>
the complete solution would be:
<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>