Page 1 of 1
Post form data to a different page id?
Posted: Sun Apr 19, 2009 12:08 pm
by devolver
HI!
I am trying to post form data to a different page that the original page but am having some problems.
I do use a form action where is set the returnid to another page (that exists) but as the $id doesn't match I don't get the expected result from the module on that page (it renders the default action and ignores the posted data).
My setup for this looks like this.
1. On the frontpage I use a action showing a form. (I want that form to be posted to another page)
2. The recieving page uses the same module and should process the incoming data.
Is there a way to do this without breaking CMSMadeSimple?
/Mikael
Re: Post form data to a different page id?
Posted: Mon Apr 20, 2009 3:00 am
by Ted
Modules expect certain pieces of data in the form. For instance there is a hidden field that has a mact field in it (which has a page id in it), all the fields has an id prefix on their names, etc.
Modules we're really designed to post to themselves. You might have to do some research in order to get that totally working correctly.
Re: Post form data to a different page id?
Posted: Tue Apr 21, 2009 8:47 pm
by NaN
Can you explain what kind of module you are using?
How is the form created?
How does the form look like?
And how is the module "searching" for the forms data?
Re: Post form data to a different page id?
Posted: Wed Apr 22, 2009 6:37 pm
by devolver
I'm developing a new module that features a plugin mode that displays a list of options. These options represent categories. When submitted I want to display a list of items that match the options selected. Very simple (and part of a much more complex module handling members) but the thing is that this option display is a part of the frontpage that also features news, calendar, advertisment and similar stuff. So if the form gets submitted to the frontpage it looks quite cluttered. I want to display the list on another page.
Re: Post form data to a different page id?
Posted: Wed Apr 22, 2009 9:25 pm
by NaN
How do you perform the output of the module?
Are you using the functions of the module api?
(createformstart(), createinputtext(), ...)
There is a function in the module api called redirect or redirectfrontend (or so).
If your module is submitted just redirect with the whole $params array() to another page where your module is called again (without news etc.) but with some additional params ({cms_module module=YourModule action="doSomething"}).
You now can check for that param and instead of displaying the form just display the content of the $params array().
I hope you understand what i mean since english isn't my native language.
Re: Post form data to a different page id?
Posted: Sun Apr 26, 2009 9:40 am
by devolver
I have found that CMSMadeSimple handles the posting to another page poorly and currently I don't have time to modify the core files so I decided to put it at the back of my mind. But there should really be some consideration in future version to handle direct module interactions to enable for example good ajax integration.
I appreciate for the help guys!
/Mikael
Re: Post form data to a different page id?
Posted: Wed Apr 29, 2009 9:42 am
by Ted
Ah, you're writing your own module. I thought you were hacking FormBuilder or something.
You can set the $return_id at the top of an action to whatever you want. When CreateForm() is used, it will take that $return_id that you pass it and create the hidden field to post to where you want. Also, in this case, you want to make sure $inline is false, because that will put the values into {content} on the next page instead of current location on the current page.
An example of $inline being false is the Search module -- it has it's search box somewhere near the top, but when you hit submit, the search results take over {content} instead of showing up in that little space.