Skip to content

Basic use

Steve "Uru" West edited this page Jun 21, 2014 · 7 revisions

The first step is to build a Form object and add Inputs and/or Fieldsets to it. After this you can use a Renderer to create the html for the form.

Creating a Form

<?php

use Fuel\Fieldset\Form;
use Fuel\Fieldset\Input;

$form = new Form;

$form[] = new Input\Text('name');
$form[] = new Input\Submit('submit', [], 'GO!');

//This will repopulate the form with any submitted data
$form->repopulate();

The form can then be rendered like so:

<?php

use Fuel\Fieldset\Render\BasicRender;

$engine = new BasicRender();

$formHtml = $engine->render($form);
Clone this wiki locally