Calling a form by URL
From FacileWiki
Forms can directly called by URL. This is useful in many cases, for example
- Call a form page without need of a menu entry
- Chaining of forms (one form calls the next)
- Passing information about the current content into a form (for ex. a commenting form)
Contents |
Basic Samples
Plain Mambo/Joomla PHP:
mosRedirect(
'index.php?option=com_facileforms&ff_name=SamplePizzaShop&ff_border=0'
);
Pieces and Scripts using FF library functions:
ff_redirectParent(
'index.php?option=com_facileforms&ff_name=SamplePizzaShop&ff_border=0'
);
ff_redirect(
'index.php?option=com_facileforms&ff_name=SamplePizzaShop&ff_border=0',
target='blank', method='get'
);
ff_redirectForm('SamplePizzaShop', '&ff_frame=0&ff_border=0');
HTML:
<a href="index.php?option=com_facileforms&ff_name=SamplePizzaShop&ff_border=0">Order Pizza</a>
Standard Form Parameters
These parameters are built into Facile Forms:
ff_name The name of the form (mandatory)
ff_page Starting page number. Default: 1
ff_frame Run in iframe 0=no/1=yes. Default: 1
ff_border Show a border 0=no/1=yes. Default: 1
ff_align Horizontal Align: Default: 1
0=left/1=center/2=right/
>2=left margin in pixels
ff_top Top margin in pixels Default: 0
Adding an Itemid
You will notice that by calling the form without an Itemid will only show those modules on the page that are assigned to all pages. Often you however need more control of the modules and that is when the Itemid parameter comes into game. You can take an existing page where the modules are the same as you want to show along with the form. You can find the Itemid number by looking into the respective menu definition in the joomla/mambo backend. You can also make a special menuitem for the form in a menu that is not displayed in your template, and then go to the modules to assign the wanted modules to it.
Now all left to do is append or insert that Itemid in the url:
<a href="index.php?option=com_facileforms&ff_name=SamplePizzaShop&ff_border=0&Itemid=112">Order Pizza</a>
Using custom parameters
Custom form parameter names are recommended to have a name starting with ff_param_. It is possible to also use parameters not starting with ff_param_ but only if the target form is not running in a frame, only custom parameters starting with ff_param_ will be forwarded into forms running in iframe.
Examples calling the form with custom parameters:
mosRedirect(
'index.php?option=com_facileforms'.
'&Itemid=45'.
'&ff_param_email='.urlencode($email).
'&ff_param_calledby='.$itemid
);
Example retrieving custom parameters in the target form by a Piece:
$email = ff_getParam('ff_param_email');
$calledby = ff_getParam('ff_param_calledby');