1. Go to this page and download the library: Download marvin255/serviform library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
if ($form->loadData() && $form->validate()) {
//get data form form
$formData = $form->getValue();
//here is some action if form's data is valid, e.g. mail() or redirect
}
echo $form;
use marvin255\serviform\helpers\FactoryField;
$form = FactoryFields::initElement('form', [
'name' => 'feedback',
'elements' => [
'message' => [
'type' => 'form',
'elements' => [
'name' => [
'label' => 'Name',
'type' => 'input',
],
'email' => [
'label' => 'Email',
'type' => 'input',
],
'message' => [
'label' => 'Message',
'type' => 'textarea',
],
],
'rules' => [
[['name', 'email', 'message'], ' => [
'type' => 'button',
'label' => 'Send',
],
],
]);
if ($form->loadData() && $form->validate()) {
//get data form form
$formData = $form->getValue();
//here is some action if form's data is valid, e.g. mail() or redirect
}
echo $form;
use serviform\helpers\FactoryFields;
FactoryFields::setDescription('input', [
'type' => '\My\Awesome\Input', // we can set new class for builtin field types
'label' => 'Default label', // we can set any default setting for each of newly created fields
]);
use serviform\helpers\FactoryValidators;
FactoryValidators::setDescription('new_rule', [
'type' => '\My\Awesome\Rule', //
use serviform\helpers\FactoryValidators;
FactoryFields::setDescription(' rule
'skipOnError' => true, // we can set any default setting for each of newly created rules
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.