How to send parameter to a FormBuilder page

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
postiffm
Forum Members
Forum Members
Posts: 128
Joined: Tue Nov 30, 2010 12:16 am

How to send parameter to a FormBuilder page

Post by postiffm »

I am converting a site that consists of a bunch of php files into CMS Made Simple 2.0.1.1. There is a page for each staff person in the organization, and each page has a link like this:

<a href="contact.php?id=unique-id-for-this-person">Contact Me</a>

So, a bunch of similar links point to a single form that manages emailing the particular person. How can I duplicate this functionality?

I saw a similar question on the Forum where the issue had to do with passing a parameter to the {FormBuilder} call, but this is a bit different since the parameter there is passed inside CMS instead of from a URL as in my case.

Can someone give a suggestion as to the correct "CMSMS way" to do what I need to do?

Thanks,

Matt
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: How to send parameter to a FormBuilder page

Post by velden »

Usually one would use a module (like e.g. LISE) to create the 'pages' for every person.
(Not very relevant per se)

The GET parameter you supply in the url ('id') can be used inside cmsms:

Code: Select all

{$smarty.get.id}
You can also use CGSimpleSmarty module and its module_action_url method (read help)
{module_action_url}

A smarty plugin that can create a url to a module action.

Arguments:

module - The module to create a link to. This argument is optional, the system will attempt to detect the current module name (if within a module action)
action (default) - The action to call within the module
page - Specify the destination page
jsfriendly|forjs - Turns on the urlonly parameter, and indicates that javascript friendly urls are output.
forajax - Turns on the jsfriendly parameter (and the urlonly parameter), and also appends showtemplate=false to the URL output for AJAX requests
assign - Assign the output of the plugin to the named smarty variable.


Any other arguments to the smarty plugin will be added to the URL generated.

Example:

{module_action_url module='News' action='fesubmit' assign='foo'}
You can then create a link to a FormBuilder form with unique parameters per person 'page'.
However, be sure to test if the specific parameter CAN be used to supply a value to FormBuilder first. Not every field definition type can handle it.
Further you might want to test if the url doesn't disclose too much information regarding the supplied parameters (email-adres).

Finally, always take some security precautions when using 'user input' (the url parameters).
Post Reply

Return to “CMSMS Core”