PHP Classes

File: site/demos/form.php

Recommend this page to a friend!
  Packages of Boss Ibrahim Mussa   Caelrik   site/demos/form.php   Download  
File: site/demos/form.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Caelrik
Build Web user interface from PHP components
Author: By
Last change:
Date: 8 days ago
Size: 667 bytes
 

 

Contents

Class file image Download
<?php

use Caelrik\Ui\Components\Form;
use Caelrik\Ui\Components\Form\Field;

return Form::make('signup')
    ->action('/signup')
    ->errorSummary()
    ->add(
        Field::text('name')->required()->maxLength(80),
        Field::email('email', 'E-mail')->required()->help('We never share your e-mail.'),
        Field::tel('phone')->mask('(999) 999-9999')->help('Optional.'),
        Field::password('password')->required()->minLength(8),
        Field::select('country', ['fr' => 'France', 'ca' => 'Canada', 'cd' => 'DR Congo'])->placeholder('Choose...'),
        Field::checkbox('terms', 'I accept the terms')->required(),
    )
    ->submit('Create account');