I am creating custom field form for menu item on Joomla 2.5. The problem is upon saving it is returning error "Field required: Template" even though there is value in it.
This is the code for the field:
jimport('joomla.html.html');
jimport('joomla.form.formfield');
class JFormFieldTemplate extends JFormField {
protected $type = 'template';
protected function getInput() {
$html = '<select> <option value="1">Template 1</option> </select>';
return $html;
}
And this is how I call it:
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="Display Template">
<message>
<![CDATA[Select Template to Display]]>
</message>
</layout>
<fieldset addfieldpath="/administrator/components/com_mycomponent/models/fields">
<fields name="request">
<fieldset name="request">
<field name="id" type="template" label="Template"
description="Select template to display"
required="true" />
</fieldset>
</fields>
</fieldset>
</metadata>
To clarify yes "com_mycomponent" is the component name.
Unfortunately the Joomla documentation is not the best out there... What am I missing here?
Thanks