My attempt is to re-build the example here: https://docs.joomla.org/Creating_a_custom_form_field_type
Somehow, Joomla doesn't see the City.php
file in administrator/components/com_testing/models/fields.
Even when I force a syntax error inside the City.php
file (e.g. deleting an ;
at the end of a line), no error is displayed. So I am assuming the City.php
file isn't even included.
I tried to include the new field path via addfieldpath
in fieldset
-definition and also with JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
in the model's getForm
-function.
Nothing worked so far.
The output is a text input field, which I do not want.
Here is my source code:
City.php
file is equivalent to the one in the link above.
administrator/components/com_testing/models/forms/testing.xml
:
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_testing/models/fields">
<field
name="testingfield"
type="City"
multiple="true"
size="7"
label="Testinglabel">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="D">D</option>
<option value="E">E</option>
<option value="F">F</option>
<option value="G">G</option>
</field>
</fieldset>
</form>