Difference between revisions of "Creating a custom form field type"
From Joomla! Documentation
m (moved Talk:Overriding JFormFields to Talk:Creating a custom form field type: Moved page for consistency) |
|||
Line 1: | Line 1: | ||
Set up base class is not neccessary. I have implemented custom list field using JFormField as parent class. | Set up base class is not neccessary. I have implemented custom list field using JFormField as parent class. | ||
No need for class like specified in step 2, just write our getInput() or getOptions(). | No need for class like specified in step 2, just write our getInput() or getOptions(). | ||
+ | |||
+ | - unknown author | ||
+ | |||
+ | <br> | ||
+ | <hr> | ||
+ | <br> | ||
+ | |||
+ | When creating a custom field for a front-end component ( /administrator/components/<component>/views/<view>/tmpl/<layout>.xml ) I was unable to use the custom field until I added the field path to my <fieldset> | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <fieldset addfieldpath="/administrator/components/<component>/models/fields" ...> | ||
+ | <field name="foo" type="customFieldName" ... /> | ||
+ | </fieldset> | ||
+ | </source> | ||
+ | |||
+ | I don't know where else this would be required, ie: if it's required when using /administrator/components/<component>/models/forms/<whatever>.xml. | ||
+ | |||
+ | I also don't know if there is an alternative to using addfieldpath. | ||
+ | |||
+ | |||
+ | [[User:Drewgg|Drewgg]] 12:14, 30 May 2012 (CDT) Drewgg |
Revision as of 12:14, 30 May 2012
Set up base class is not neccessary. I have implemented custom list field using JFormField as parent class. No need for class like specified in step 2, just write our getInput() or getOptions().
- unknown author
When creating a custom field for a front-end component ( /administrator/components/<component>/views/<view>/tmpl/<layout>.xml ) I was unable to use the custom field until I added the field path to my <fieldset>
<fieldset addfieldpath="/administrator/components/<component>/models/fields" ...>
<field name="foo" type="customFieldName" ... />
</fieldset>
I don't know where else this would be required, ie: if it's required when using /administrator/components/<component>/models/forms/<whatever>.xml.
I also don't know if there is an alternative to using addfieldpath.
Drewgg 12:14, 30 May 2012 (CDT) Drewgg