initial commit
This commit is contained in:
commit
1cc4bf3572
254 changed files with 63622 additions and 0 deletions
htdocs/libraries/Nibble-Forms
36
htdocs/libraries/Nibble-Forms/form_example.php
Normal file
36
htdocs/libraries/Nibble-Forms/form_example.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
/* Require Nibble Forms 2 */
|
||||
require_once __DIR__ . '/Nibble/NibbleForms/NibbleForm.php';
|
||||
|
||||
/* Get Nibble Forms 2 instance called mega_form */
|
||||
$form = \Nibble\NibbleForms\NibbleForm::getInstance('mega_form');
|
||||
|
||||
/* Text field with custom class and max length attribute */
|
||||
$form->addField('text_field', 'text', array(
|
||||
'class' => 'testy classes',
|
||||
'max_length' => 20
|
||||
));
|
||||
|
||||
/* Email field, not required and custom label text */
|
||||
$email = $form->addfield('email', 'email', array(
|
||||
'required' => false,
|
||||
'label' => 'Please enter your email address'
|
||||
));
|
||||
/* Email confirmation field which must match the value for email */
|
||||
$email->addConfirmation('confirm_email', array(
|
||||
'label' => 'Please confirm your email address'
|
||||
));
|
||||
|
||||
/* Radio button field with two options, first option has an additional attribute */
|
||||
$form->addField('choice', 'radio', array(
|
||||
'choices' => array(
|
||||
"one" => array('data-example' => 'data-attribute-value', 'Choice One'),
|
||||
"two" => "Choice Two"),
|
||||
'false_values' => array("two")
|
||||
));
|
||||
|
||||
/* If the form is valid, do something */
|
||||
if ($form->validate()) {
|
||||
echo "Form has validated";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue