1

I have a config.xml with some parameters for my component.

I need to define these parameters for each individual item.

So in admin/models/forms/myview.xml, I've written my fields:

<fields name="params">
    <fieldset name="params" label="JGLOBAL_FIELDSET_DISPLAY_OPTIONS">
    ...etc

and in my admin/tables/myview.php, inside the "bind" function

if (isset($array['params']) && is_array($array['params']))
{
    // Convert the params field to a string.
    $parameter = new JRegistry;
    $parameter->loadArray($array['params']);
    $array['params'] = (string)$parameter;
}

The form is able to save data "params" in the database, but doesn't retrieve any params if saved.

2
  • It's unclear how you're retrieving data from database.
    – Sharky
    May 11, 2022 at 5:13
  • This is the question ... the data is saved in the dbase but the relative fields of the form are not populated May 11, 2022 at 7:10

1 Answer 1

0

To resolve the behaviour, I've deleted this function:

public function getItem($pk = null)
{
    if ($item = parent::getItem($pk))
    {
        if (isset($item->params))
        {
            $item->params = json_encode($item->params);
        }
    }
    return $item;
}

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.