1

I have this code here, which I modified in the getForm function from my Model Class:

$elementHeader='
            <fieldset name="reportFilters">';
    $elementName = $elementHeader;

    $form = $this->loadForm('com_subscription.subscriptions', 'subscriptionsform', array('control' => 'jform', 'load_data' => $loadData));
    if (empty($form)) {
        return false;
    }

    $jinput = JFactory::getApplication()->input;
    $report= $jinput->get('reportId','0',null);

    $this->filterlist = $this->getReportFilters($report);

    foreach($this->filterlist as $filter_record)
    {
        $newfield = $this->generateXML($filter_record);
        if($newfield=='')
        {

        }
        else
        {
            $elementName = $elementName.$newfield;
        }
    }

    $elementName = $elementName.
    '</fieldset>'
    ;

    $element = new SimpleXMLElement($elementName);
    $form->setfield($element);

    return $form;

If you would observe, I customized the code to load the form together with the custom fields.

How can I pass this generated form to another function when saving the data from edit form?

1 Answer 1

0

If I understand what you are trying to do it looks like you have an edit layout, your form model is loading the form as you wanted it to, and your data is not saving as anticipated.

So you need to override your default save function for your data.

In your controller create a new function for save and it should override the default save function for Joomla

public function save()
{
    //GET THE DATA SUBMITTED BY THE FORM
    $JInput = JFactory::getApplication->input;
    $jform = $JInput->get('jform','','array);

    //DO STUFF WITH YOUR SUBMITTED FORM DATA
}

That is, if I understood your question.

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.