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.

enter image description here 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');


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>'.

in default.xml of component frontend, I added the field:

<?xml version="1.0" encoding="utf-8"?> <metadata>
    <fields name="request">
        <fieldset name="request" addfieldpath="components/com_hccxmlbeheer/models/fields">
    </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


What am I missing?

  • After many years of membership on Stackoverflow, thank you for coming to JSE. Please take our tour. Mar 8, 2020 at 0:41

1 Answer 1


Rename actiecode.php to actiecodes.php.

Class name, filename and field type in XML form must all match.

  • This was the solution, it was not clear in the documentation i found. i sugested an update. Thanks you verry mutch Mar 7, 2020 at 16:56
  • Could you please provide the link to the document that was not clear enough? @Bas Mar 8, 2020 at 1:16
  • Is there a relevant up to date document?
    – mbrampton
    Mar 13, 2023 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.