Location: PHPKode > projects > ProForma > proforma_0.1-prealpha/examples/example1.php
<?php

$occupation = array(
	1 => 'Doctor',
	2 => 'Lawyer',
	3 => 'Teacher',
	4 => 'Web Designer',
);

$req = new pfRequiredValidator('This field is required!');

$form = new pfForm();
$form->setDepth(1);

$fieldset = $form->addFieldset('Contact Details');
$fieldset->addText('name', 'Name')->addValidator($req);
$fieldset->addRadioGroup('occupation', 'Occupation')->fromArray($occupation)->addValidator($req);
$fieldset->addText('telephone', 'E-mail address')->addValidator(new pfLengthValidator(6, 'Error'));
$fieldset->addText('email', 'Telephone');
$fieldset->addTextarea('comment', 'Comment')->setDims(array(2, 13));
$fieldset->addCheckboxGroup('occupation2', 'Second Occupation')->fromArray($occupation);
$fieldset->addPassword('password', 'Password');
$fieldset->addSelect('occupation3', 'Third Occupation')->fromArray($occupation);
$fieldset->addCheckbox('agree', 'I agree to the <a href="#">terms and conditions</a>');

$form->addSubmit('submit', 'Submit');
Return current item: ProForma