I am trying to get a custom field type into the menu. I want this to be a dropdown which I poulate with some php code.
Where the arrow points in want my dropdown field.
So I created in /components/com_hccxmlbeheer/models/fields/actiecode.php with the following code:
// Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access');
jimport('joomla.form.formfield');
class JFormFieldActiecodes extends JFormField {
protected $type = 'Actiecodes';
// getLabel() left out
public function getInput() {
return '<select id="'.$this->id.'" name="'.$this->name.'">'.
'<option value="1" >New York</option>'.
'<option value="2" >Chicago</option>'.
'<option value="3" >San Francisco</option>'.
'</select>';
}
}
in default.xml of component frontend, I added the field:
<?xml version="1.0" encoding="utf-8"?> <metadata>
<layout title="COM_HCCXMLBEHEER_HCCXMLBEHEER_VIEW_AANMELDFORM_TITLE">
<message>COM_HCCXMLBEHEER_HCCXMLBEHEER_VIEW_AANMELDFORM_DESC</message>
</layout>
<fields name="request">
<fieldset name="request" addfieldpath="components/com_hccxmlbeheer/models/fields">
<field
addfieldpath="/components/com_hccxmlbeheer/models/fields"
name="actiecode"
type="Actiecodes"
label="COM_HCCXMLBEHEER_HCCXMLBEHEER_ACTIECODELABEL"
description="COM_HCCXMLBEHEER_HCCXMLBEHEER_ACTIECODEDESC"
>
</field>
</fieldset>
</fields> </metadata>
I see the field, but is not a dropdown and I can't select anything.
I also added to components/com_hccxmlbeheer/models/aanmeldformulier
JFormHelper::addFieldPath(JPATH_COMPONENT.'/models/fields');
What am I missing?