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

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
philmeister
New Member
New Member
Posts: 2
Joined: Wed Apr 28, 2010 9:48 am

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

Post 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.
NaN

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

Post 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)
Last edited by NaN on Thu Apr 29, 2010 11:09 am, edited 1 time in total.
philmeister
New Member
New Member
Posts: 2
Joined: Wed Apr 28, 2010 9:48 am

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

Post by philmeister »

Your than man NaN!! Thanks a lot, it works... Was wondering what the $returnid is used for. Cheers!  ;D
Post Reply

Return to “Developers Discussion”