I made a custom field and using it in a subform looking somewhat like this:
<config>
<fields name="params">
<fieldset name="basic" addfieldpath="/administrator/components/com_mycomp/models/fields">
<field name="base_url" type="url" required="true" default="" label="base_url" />
<field name="examplefield" type="text" required="true" default="" label="examplefield" />
<field name="items" type="subform" multiple="true" min="1" layout="joomla.form.field.subform.repeatable-table" buttons="add,remove" groupByFieldset="false" label="items">
<form>
<fieldset name="section1" label="Section1">
<field name="item" label="item" type="myfield" />
</fieldset>
</form>
</field>
</fieldset>
</fields>
</config>
The custom field "myfield" needs to access the value from the base_url field in the parent form:
defined('_JEXEC') or die;
JFormHelper::loadFieldClass('list');
class JFormFieldMyfield extends JFormFieldList
{
protected $type = 'Myfield';
public function getOptions() {
// need to access base_url field value
// not working with subform
// $base_url = $this->form->getFieldset('basic', 'jform')['jform_params_base_url']->value;
Before i made a subform out of this i could do it like this:
$base_url = $this->form->getFieldset('basic', 'jform')['jform_params_base_url']->value;
Whats the best way to access values of fields in the parent form?