Form
This model defines a form, including a list of form controls to submit data to the page.
Classname
Photon\CmsEngine\Model\Element\Form
Attributes
Attribute | Type | Description |
---|---|---|
$id | integer | The id of this form in the database, where the form is content managed |
$title | string | The title of the form |
$controls | array | An array of form controls that make up this form page |
$errors | array | An array of errors found in the form following validation |
$action | string | The content of the action attribute of the form HTML element |
$method | string | The content of the method attribute of the form HTML element |
$formHeading | string | The title of this form page |
$instructions | string | Rich text content that makes up the instructions of the form page |
$primaryAction | FormControl | The form control that forms the primary action of the form, often a submit button |
$secondaryAction | FormControl | The form control that forms the secondary action of the form, often a cancel or back button |
<?php
use Photon\CmsEngine\Model\Element\Form;
use Photon\CmsEngine\Model\Element\FormControl;
$form = new Form();
$form->setTitle($title);
$form->setMethod('post');
$control = new FormControl();
$control->setName('_token');
$control->setType('hidden');
$form->addControl($control);
$control = new FormControl();
$control->setLabel($emailLabel);
$control->setName('email');
$control->setType('email');
$control->setValue('');
$control->setMandatory(true);
$control->setAutocomplete(false);
$form->addControl($control);
$control = new FormControl();
$control->setLabel($passwordLabel);
$control->setName('password');
$control->setType('password');
$control->setValue('');
$control->setMandatory(true);
$control->setAutocomplete(false);
$form->addControl($control);
$control = new FormControl();
$control->setLabel($signinButtonLabel);
$control->setName('jaduSignInButton');
$control->setType('submit');
$form->setPrimaryAction($control);