Form::getInstance deprecated what is good syntax voor j5

68 views
Skip to first unread message

Bas van den Dikkenberg

unread,
Jan 14, 2024, 3:38:47 AMJan 14
to Joomla! General Development
Good morning, i have problem finden the good replacement for the depcreted version of :

$form = Form::getInstance("eventmail", __DIR__ . "/eventmail.xml", array("control" => "eventmail"));

i tried the following:


$form = factory::getContainer()->get(FormFactoryInterface::class)->createForm("eventmail", __DIR__ . "/eventmail.xml", array("control" => "eventmail"));

With kind regards,


Bas van den Dikkenberg

Neo314

unread,
Jan 22, 2024, 6:09:26 PMJan 22
to Joomla! General Development
Did you include the use statement? I think it would be 

use Joomla\Form\FormFactoryInterface;

but I'm not sure.

Glenn Arkell

unread,
Feb 18, 2024, 7:02:59 PMFeb 18
to Joomla! General Development
Hi Bas,
Is this in your admin model?  I use the following in my model function called getForm($data = array(), $loadData = true).
// Get the form.
$form = $this->loadForm(
'com_mycomponent.transaction',
'transaction',
array('control' => 'jform',
'load_data' => $loadData )
);
Reply all
Reply to author
Forward
0 new messages