Skip to content
This repository has been archived by the owner on Dec 2, 2017. It is now read-only.

AIIXForm

ailixter edited this page Mar 5, 2016 · 18 revisions

Basic usage

---- controller.php ------------------------

\AIIX\Form::create(\AIIX\Data::ini('formdata.ini'));

---- formdata.ini --------------------------

[firstname]
-control    = text
-label      = "First Name"
placeholder = "First Name"
class       = userdata

---- template.php --------------------------

echo \AIIX\Form::label('firstname');
echo \AIIX\Form::control('firstname');

Creation

\AIIX\Form::create($formdata);

\AIIX\Form::create($formdata, new \AIIX\Input($_GET));

\AIIX\Form::create($formdata, new \AIIX\Input($_GET), '.en');

\AIIX\Form::create($formdata, new \AIIX\Input($_GET), '.en', 'english');
\AIIX\Form::create($formdata, new \AIIX\Input($_GET), '.fr', 'french');

class MyForm extends \AIIX\Form {}
\AIIX\Form::create($formdata, new \AIIX\Input($_GET), 'special', 3, 'MyForm');

Access

\AIIX\Form::create($formdata);
\AIIX\Form::choose()->set('firstname/value', $username);

\AIIX\Form::create($formdata)
    ->set('firstname/value', $username)
    ->set('password/value', '123456')
    ->set('sex/-options', array('male', 'female'));

$form = \AIIX\Form::create($formdata);
$form->set(...);

\AIIX\Form::create($formdata, $input, $mod, 'english');
$formEn = \AIIX\Form::choose('english');

\AIIX\Form::choose(new MyForm())->set('my/value', $value);
echo \AIIX\Form::control('my');

Choosing Forms

$currentForm = \AIIX\Form::choose();
$englishForm = \AIIX\Form::choose('english');
$form[3]     = \AIIX\Form::choose(3);
$newForm     = \AIIX\Form::choose(new NewForm());

more: AIIXForm Data