Search code examples
phpformsjoomla

Joomla float form field


I'm working on a component for Joomla 3.2 which needs the user to input some data in the backend, so somebody before me coded a quite effective configuration form. Now I need to extend it, adding some fields which are required by my functionalities and a couple of the fields should be floats.

Joomla's standard form field type list doesn't list any "float" field type and number looks a lot like an integer field to me. There is a way to have number behave like a float or some obscure "float" form type hidden somwehere or should I code the new form type?


Solution

  • Use a float number on the "step" attribute.

    Example:

    <field 
      name="mynumbervalue" 
      type="number" 
      default="0" 
      label="Choose an number" 
      description="" 
      min="0" 
      max="10" 
      step="0.01" />