I would like to add some data to a form field I declared in my forms.xml. This form field is a custom form field which is declared like this:
<fields name = "userdata">
<fieldset name = "personal-data">
<field name = "test"
type = "myfield"
size = "40"
country = "DE"
label = "COM_BESTIA_FIELDS_TEST_LABEL"
description = "COM_BESTIA_FIELDS_TEST_DESC"
required = "true"
filter = "safehtml" />
</fieldset>
</fields>
Now I would like to use
$form = $this->loadForm('com_bestia.item', 'item', array('control' => 'jform', 'load_data' => $loadData));
$form->setFieldAttribute('test', 'country', 'US');
to add a specific value to the country
attribute.
If I do that this way, there are no changes - it still shows DE
.
$form->setValue('test', 'country', 'US');