GoodForm


Generating your Form

So after spending all that time preparing your form object, what do you do? Generate the HTML of course!

Again, there are two ways to call the generate() method. This will wrap all elements in the object with <form> tags and return it as HTML ready to be place in your view.

This should be the last call you make to each goodform object. Anything other actions applied to the instance will have no effect after the form has been generated.

generate (string action)

Example:

$this->goodform->generate('my_controller/do_form');

Will produce the following HTML:

<form action="http://www.example.com/my_controller/do_form">
	// form contents
</form>

generate (array attributes)

Example:

$attr = array(
	'action' => 'my_controller/do_form',
	'class' => 'goodform',
	'method => 'put'
);
		
$this->goodform->generate($attr);

Will produce the following HTML:

<form action="http://www.example.com/my_controller/do_form" class="goodform" method="put">
	// form contents
</form>