I've added the following into my components XML file :

    <field name="activity_name" type="subform" label="Activity" description="" multiple="true" min="1" max="10">
            <field name="activity" type="text" label="Activity Name" filter="safehtml"/>

I've then added a new column in the relevant database table.

The new field is showing in the backend of the site when editing but it's not saving to the database.


1 Answer 1


Your sub form itself looks ok.

  • Where do you want to save the data? In a separate table?
  • Did you retrieve the form data with
        $form  = $input->post->get('jform', null, 'array');
  • How does your existing component know which form field(s) to retrieve and save?

Content Plugin

I would recommend not changing the component. Instead you could programme a Content Plugin. Within onContentAfterSave you retrieve the form input, and save it in the database.

To display the saved data in the form, you could use onContentPrepareForm to retrieve + display the data in the form.

If you save your data in a separate database table, then you should clean up that data when you delete the original record. For that you could add a onContentAfterDelete method to remove the records in your own database table.

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.