System configuration fields

There are different field types for Magento’s system configuration. These are for example:

  • Button
  • Checkboxes
  • Checkbox
  • Date
  • File
  • Hidden
  • Imagefile
  • Image
  • Label
  • Link
  • Multiline
  • Multiselect
  • Note
  • Obscure
  • Password
  • Radio
  • Radios
  • Reset Select
  • Submit
  • Textarea
  • Text
  • Time

The following snippets show you how to add them to your system.xml:

  • Enable selection (yes/no):
  • Multiselect (customer groups):
  • Product Type Selector:

     
  • Website multiselect:
  • Stores
  • Text (input type=”text):
  • Textarea:

     
  • Dependencies:
    You can define dependencies to other configuration fields like this:

    The field cliend_id is visible only if the enable selection was set to yes (1).
  • Validation:
    You can use build in field Validation for field like that:

    The validate tag adds a class to the eventual input element. Here are the standard tests that come with Magento’s form validation. They work with config fields and FE-forms (Varien_Data_Form).

    • required-entry
    • validate-admin-password
    • validate-ajax
    • validate-alpha
    • validate-alphanum
    • validate-cc-cvn
    • validate-cc-exp
    • validate-cc-number
    • validate-cc-type
    • validate-cc-type-select validate-clean-url
    • validate-code
    • validate-cpassword
    • validate-css-length
    • validate-currency-dollar
    • validate-data
    • validate-date
    • validate-date-au
    • validate-digits
    • validate-email
    • validate-fax
    • validate-greater-than-zero
    • validate-identifier
    • validate-length
    • validate-new-password
    • validate-not-negative-number
    • validate-number
    • validate-one-required
    • validate-one-required-by-name
    • validate-password
    • validate-percents
    • validate-phone
    • validate-select
    • validate-ssn
    • validate-state
    • validate-street
    • validate-url
    • validate-xml-identifier
    • validate-zero-or-greater
    • validate-zip
    • validate-zip-international
    • validate-length minimum-length-9 maximum-length-9
  • t.b.c

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.