jFormer Documentation → Form Features →
Splash Page
Splash Pages are introductory pages that allow you to introduce your form, they accept any HTML and the content is completely custom.
Usage
Constructor
Sample Usage
'splashPage' => array(
'content' => 'Welcome
',
'splashButtonText' => 'Get Started'
)
Splash Page Options
These options are specific to the Splash Page option.
false
splashPage
Array | Accepts an option array consisting of splash page content and button text, may also be just set to true, in which case content and button text are set to default.
null
content
HTML | Receives HTML content that makes up the Splash Page.
Begin
splashButtonText
String | Receives a string, a label for the button on the splash page.
Splash Page Example
splash-page-example-1.php
require_once($_SERVER['DOCUMENT_ROOT'].'/php/site.php');
// Create the form
$splashPage = new JFormer('splashPageForm', array(
'splashPage' => array('content' => 'Spash Page
This is a splash page, you can put any HTML you want here.
', 'splashButtonText' => 'LETS DO THIS'),
));
// Create the form page
$jFormPage1 = new JFormPage($splashPage->id.'Page', array(
'title' => 'Splash Page Demo
'
));
// Create the form section
$jFormSection1 = new JFormSection($splashPage->id.'Section1', array());
// Add components to the section
$jFormSection1->addJFormComponentArray(array(
new JFormComponentSingleLineText('name', 'Name:', array(
'validationOptions' => array('required'),
)),
));
// Add the section to the page
$jFormPage1->addJFormSection($jFormSection1);
// Add the page to the form
$splashPage->addJFormPage($jFormPage1);
// Set the function for a successful form submission
function onSubmit($formValues) {
return array(
'failureHtml' => json_encode($formValues),
);
}
// Process any request to the form
$splashPage->processRequest(true);
Next Page: Tooltips
This page was last edited on April 25, 2011 at 2:02pm.