Created
May 2, 2010 19:17
-
-
Save evaisse/387369 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$form = Form::create()->setMethod(Form::POST); | |
$form->addTextField('name', 'Name')->validRequired(); | |
$form->addTextField('age', 'Age')->validNumeric(); | |
$form->addSelectFIeld('rank','Rank :')->setOptions( 'User', 'Admin', 'Unknow' ); | |
$form->addTextField('autre_fonction', 'Autre fonction:'); | |
$form->addTextAreaField('adresse','Adresse:'); | |
$form->addNumericField('code_postal','Code postal:')->setAttribute('size',5)->validSize(5); | |
$form->addTextField('tel_perso','Téléphone personnel:')->validPhoneNumber(); | |
$form->addTextField('tel_ce','Téléphone de votre CE :')->validRequired()->validPhoneNumber(); | |
$form->addEmailField('email','E-mail :'); | |
$form->addSeparator(); | |
$form->addHtml('<p>Lorem ipsum dolor sit amet</p>'); | |
$form->addMultipleRadioField('question', 'How you feel ?') | |
->setOptions(array( | |
'great' => "Very Good", | |
'good' => ":)", | |
'bad' => ":(" )); | |
$form->addMultipleRadioField('plot', "Hey")->setOptions(1,2,3,4,5)->setInline(); | |
$form->addSeparator(); | |
$form->addTextAreaField('Your Words'); | |
$form->addSubmitButton()->addClass('title'); | |
?> | |
<!-- later on --> | |
<?php | |
if($_SERVER['REQUEST_METHOD'] == 'POST') | |
{ | |
$form->setData($_POST['data']); | |
if( $form->isValid() ) | |
{ | |
var_dump( $form->getData() ); | |
exit('ok'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment