Page 1 of 1

Form-based module's submit mistakenly takes me to the homepage.

Posted: Wed Apr 28, 2010 10:21 am
by philmeister
Hi all, I'm new to CMSMS.

Using version 1.6.7

I am developing a simple form-based module. The snippet of code that does this is:

$this->smarty->assign('formstart', $this->CreateFormStart($id, 'default', '', 'get', '', true));
.. other input fields ...
$this->smarty->assign('nextbutton', $this->CreateInputSubmit($id, 'btnNext', 'next >'));
$this->smarty->assign('formend', $this->CreateFormEnd());

echo $this->ProcessTemplate('guide.tpl');

The problem is, that after every submit, it takes you to the root (home page).

http://localhost/decking/moduleinterfac ... uideModule...

Along with all the module's GET request parameters - all very useless for the home page because the module is on another page!

What I really want is:

http://localhost/decking/moduleinterfac ... uideModule...

Or even better:

http://localhost/decking/index.php?page ... uideModule...

I have tried searching the site, api and google. So any help will be very, very much appreciated :-)

Philip.

Re: Form-based module's submit mistakenly takes me to the homepage.

Posted: Thu Apr 29, 2010 11:05 am
by NaN
You need to pass the returnid to your CreateFormStart function.
In your call this argument it just empty.
If you 're calling this in an action.[ActionName].php of your module the var $returnid should be just avaliable:

$this->CreateFormStart($id, 'default', $returnid, 'get', '', true);


The $returnid in your case will contain the current page id.
So if the module has finished its task the CMS shows its output on the page given by the $returnid.
If it is empty the CMS does not know where to show the module output and redirects to the start page.

(I'm sure you already know the API docs but just in case ;) : http://www.cmsmadesimple.org/apidoc/CMS ... eFormStart)

Re: Form-based module's submit mistakenly takes me to the homepage.

Posted: Sun May 02, 2010 3:15 am
by philmeister
Your than man NaN!! Thanks a lot, it works... Was wondering what the $returnid is used for. Cheers!  ;D