I'm still creating a component for Joomla 2.5 that have 4 forms: one main form (title, description) and others 3 forms with more fields. Main form have an id autoincrement that is the foreign key for other tables.
mainTable -> PK: id
secondTable -> PK: id, FK: idMainTable
thirdTable -> PK: id, FK: idMainTable
fourTable -> PK: id, FK: idMainTable
When I try to retrieve the populate forms, the id passed over the forms is the same of main form (pk of main form).
In view.html.php
function display($tpl = null)
{
// Initialiase variables.
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->mainForm = $this->get('Form');
// GET OTHER MODELS FOR OTHER FORMS
$secondMod = JModel::getInstance('second', 'secondModel');
$this->secondForm = $secondMod->getForm();
$thirdMod = JModel::getInstance('third', 'thirdModel');
$this->thirdForm = $thirdMod->getForm();
$fourMod = JModel::getInstance('four', 'fourModel');
$this->fourForm = $fourMod->getForm();
...
parent::display($tpl);
}
All forms are loaded, but the passed id is the same for mainModel, so the forms for the other 3 models are empty.
How can I get the complete form with correct loaded data and the correct relationship?
Thanks