Page 1 of 1

[Resolved] How to get module id?

Posted: Tue Jul 29, 2008 11:36 am
by irish
I have built two modules, I need to be able to put a form on module A that submits to module B. In module A, I tried this:

Code: Select all

$members = $this->GetModuleInstance('Members');
$mid = $members->cms->variables['modulenum'];

$smarty->assign('formStart2', $this->CreateFormStart($mid, 'login', $returnid,'post','',true,'',array(),'class="LoginForm"'));
...
but when I submit the form in module A it doesn't send it to module B as expected.

is that the right way to get the module number?

[Resolved] Re: How to get module id?

Posted: Tue Jul 29, 2008 4:19 pm
by irish
OK, after spending the day on this, I've got it to work. Here is what I have done so far.

In module B (Members):
action.default.php - I grabbed the value of $params["show"] and if == 'badge' then include action.showbadge.php
action.showbadge.php - displays the login form and any other functionality
I changed the form tag which is located in action.showbadge.php  to this:

Code: Select all

$smarty->assign('formStart2', $this->CreateFormStart($id, 'login', $returnid,'post','',true,'',array(),'class="LoginForm"'));
In module A:
on the page that I want the form displayed, I added this: {cms_module module="Members" show="badge" }

This works great, displays the form as needed and the hidden fields of that form are showing this:




When I submit the form, it goes to Members::login authenticates and redirects back to the page they were on.

I hope this helps someone and saves them a day of banging their head against a wall.