Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vodolaz095/triviaform

PHP library for generating html4 forms and validation of their submit
https://github.com/vodolaz095/triviaform

Last synced: about 4 hours ago
JSON representation

PHP library for generating html4 forms and validation of their submit

Awesome Lists containing this project

README

        

TRIVIAform
==========

PHP library for generating html4 forms and validation of their submit

Example code
```php

Form Test

addText('Text','Text');
$form1->addTextArea('long_text','Long text');
$form1->addCheckBox('checkbox1','Checkbox',1);
$form1->addCheckBox('checkbox2','Selected checkbox',1,true);
$form1->addLabel('Label','Label','Test');
$form1->addPassword('password','Password');
if($form1->submit())
{
echo '

Form 1 submited

';
echo '
';

print_r($form1->getClean());
echo '
';
}
echo '

Form1

';
echo $form1->render('Save','Cancel');

$form2=new FORM('form2_csrt_key');
$form2->addText('digit1','Single digit from 0 to 9','','~^\d$~');
$form2->addText('digit2','Single digit from 0 to 9. But NOT 5','','~^\d$~');
if($form2->submit())
{
if($form2->getClean('digit2')==5)
$form2->setError('digit2','NOT 5 PLEASE!');
echo '

Form 2 submited

';
echo '
';

print_r($form2->getClean());
echo '
';
}
echo '

Form2

';
echo $form2->render('Save','Cancel');
?>

```