MVC-Layout not called
Hello,
in Do_Init of the main controller I´m creating the subcontrollers
sub_edit ?= create_controller( controller_name = 'edit.do' controller_id = 'editctrl' ). subc_user ?= create_controller( controller_name = 'overview/user.do' controller_id = 'userctrl' ).
in Do_Request of Edit.do I call the layout Edit.htm and in this one I call the subcontroller userctrl
<%-- Code Personal Nr. --%> <bsp:call comp_id = "userctrl"></bsp:call>
the damned layout never shows up in the application and I don´t know why. This other option does not work:
<bsp:call comp_id = "editctrl_userctrl" />
Can somebody tell me what the problem is ??
Thanks a lot.
Former Member replied
Hi,
Does it have to be the same controller instance for both main and edit controllers? I think you should create two controller instances, one for main and another for edit.
If you need the same instance, you can create it in main.do, then register it as a subcontroller of edit.do with if_bsp_dispatcher~register method. Still, this sounds weird to me since you will call twice the same controller within the same htmlb:form tag, which can create field ID conflicts. You will have to be careful if you use this.
Code example, in main controller:
edit_ctrl ?= create_controller( controller_name = 'edit.do' controller_id = 'edit' ). user_ctrl ?= create_controller( controller_name = 'user.do' controller_id = 'user' ). edit_ctrl->if_bsp_dispatcher~register( comp_id = 'edit_user' comp_instance = user_ctrl ).
In main.htm:
<bsp:call comp_id = "edit"></bsp:call> <bsp:call comp_id = "user"></bsp:call>
In edit.htm:
<bsp:call comp_id = "user"></bsp:call>
Hope it helps,
Tanguy