Add/Edit forms in custom module
Hi ,
I created two forms for adding and editing in my new custom module by using developer mode.
Then I created one page in my module and tried to load one add form to this module's page. But I am stuck here, any one can please help me how to connect my forms in a custom module page.
-
-
·
LeonidS
- ·
Hello @Mariya !
The example of add and edit modes of the custom form has been provided here:
https://github.com/unaio/una/wiki/Dev-Forms#example-of-usage
-
·
LeonidS
-
- · Mariya
- ·
Hi @LeonidS ,
Can you suggest where I have to add this code to print the forms?
-
- · Mariya
- ·
Thank you @LeonidS , for your support. I solved this issue by the following steps.
added this code to the Page->Code section
array (
'module' => 'vnd_team',
'method' => 'form_add',
Created one service function in module class file
function serviceFormAdd(){
$oForm = BxDolForm::getObjectInstance('team_form_objects', 'team_form_objects_add'); // get form instance for specified form object and display
if (!$oForm)
die('"team_form_objects_add" form object or "team_form_objects_add" display is not defined');
$oForm->initChecker(); // init form checker witout any data - adding new record
if ($oForm->isSubmittedAndValid()) {
$oForm->insert ();
}
return $oForm->getCode(); // display form
}