コード例 #1
0
 public function testMain()
 {
     $frm = new SpoonForm('name', 'action');
     $frm->addButton('submit', 'submit');
     $frm->addCheckbox('agree', true);
     $frm->addDate('date', time(), 'd/m/Y');
     $frm->addDropdown('author', array(1 => 'Davy', 'Tijs', 'Dave'), 1);
     $frm->addFile('pdf');
     $frm->addImage('image');
     $frm->addHidden('cant_see_me', 'whoop-tie-doo');
     $frm->addMultiCheckbox('hobbies', array(array('label' => 'Swimming', 'value' => 'swimming')));
     $frm->addPassword('top_sekret', 'stars-and-stripes');
     $frm->addRadiobutton('gender', array(array('label' => 'Male', 'value' => 'male')));
     $frm->addTextarea('message', 'big piece of text');
     $frm->addText('email', '*****@*****.**');
     $frm->addText('now', date('H:i'));
 }
コード例 #2
0
ファイル: form.php プロジェクト: nickmancol/forkcms-rhcloud
 /**
  * Adds a single textarea.
  *
  * @param string $name The name of the element.
  * @param string[optional] $value The value inside the element.
  * @param string[optional] $class Class(es) that will be applied on the element.
  * @param string[optional] $classError Class(es) that will be applied on the element when an error occurs.
  * @param bool[optional] $HTML Will the element contain HTML?
  * @return SpoonFormTextarea
  */
 public function addTextarea($name, $value = null, $class = null, $classError = null, $HTML = false)
 {
     $name = (string) $name;
     $value = $value !== null ? (string) $value : null;
     $class = $class !== null ? (string) $class : 'textarea';
     $classError = $classError !== null ? (string) $classError : 'textareaError';
     $HTML = (bool) $HTML;
     // create and return a textarea
     return parent::addTextarea($name, $value, $class, $classError, $HTML);
 }
コード例 #3
0
ファイル: edit.php プロジェクト: jincongho/clienthub
     $tpl->assign('photo_path', BASE_URL . '/images.php?thumbnail=1&id=' . (int) $_GET['id']);
 }
 $frm->addText('name', $get_user['name']);
 $frm->addText('ic', $get_user['ic']);
 $frm->addDropdown('gender', array('' => '', 'male' => 'Male', 'female' => 'Female'), $get_user['gender']);
 $frm->addText('placeofbirth', $get_user['placeofbirth']);
 $frm->addText('education', $get_user['education']);
 $frm->addText('language', $get_user['language']);
 $frm->addText('race', $get_user['race']);
 $frm->addText('faith', $get_user['faith']);
 $frm->addText('maritalstatus', $get_user['maritalstatus']);
 $frm->addText('nationality', $get_user['nationality']);
 $frm->addText('profession', $get_user['profession']);
 $frm->addText('epf', $get_user['epf']);
 $frm->addText('banker', $get_user['banker']);
 $frm->addTextarea('address', $get_user['address']);
 $frm->addText('contactno', $get_user['contactno']);
 $frm->addText('email', $get_user['email']);
 $frm->addText('platesno', $get_user['platesno']);
 $frm->addText('assets', $get_user['assets']);
 $frm->addText('height', $get_user['height'])->setAttribute('placeholder', 'digits only');
 $frm->addText('weight', $get_user['weight'])->setAttribute('placeholder', 'digits only');
 $frm->addDropdown('blood', array('' => '', 'O+' => 'O+', 'A+' => 'A+', 'B+' => 'B+', 'AB+' => 'AB+', 'O-' => 'O-', 'A-' => 'A-', 'B-' => 'B-', 'AB-' => 'AB-'), $get_user['blood']);
 $frm->addText('eye', $get_user['eye']);
 $frm->addText('hair', $get_user['hair']);
 $frm->addText('skin', $get_user['skin']);
 $frm->addText('dna', $get_user['dna']);
 $frm->addTextarea('family', $get_user['family']);
 $frm->addTextarea('casereport', $get_user['casereport']);
 setCompanyValue($frm, $get_user['company']);
 $frm->addTextArea('remarks', $get_user['remarks']);
コード例 #4
0
ファイル: index.php プロジェクト: jincongho/clienthub
 * @package Client Manager
 * @author Jin Cong<*****@*****.**>
 */
define('LOAD_TEMPLATE', true);
define('LOAD_HEADER', true);
require 'loader.php';
//create new SpoonForm
$frm = new SpoonForm('newProfile');
//create forms elements
$frm->addTexts('file', 'case', 'name', 'ic', 'placeofbirth', 'education', 'language', 'race', 'faith', 'maritalstatus', 'nationality', 'profession', 'epf', 'banker', 'contactno', 'email', 'platesno', 'assets', 'eye', 'hair', 'skin', 'dna');
for ($i = 1; $i < 6; $i++) {
    $frm->addText('company' . $i)->setAttribute("placeholder", "公司名字 company name");
    $frm->addText('registerno' . $i)->setAttribute("placeholder", "注册号码 registration number");
    $frm->addText('companyno' . $i)->setAttribute("placeholder", "公司号码 Company number");
    $frm->addText('companyemail' . $i)->setAttribute("placeholder", "公司电邮 Company email");
    $frm->addTextarea('shareholder' . $i)->setAttribute("placeholder", "公司股东 Shareholder");
    $frm->addTextarea('registeraddr' . $i)->setAttribute("placeholder", "注册地址 Registered Address");
    $frm->addTextarea('businessaddr' . $i)->setAttribute("placeholder", "营业地址Business Address");
}
$frm->addTextareas('address', 'family', 'remarks', 'casereport');
$frm->addImage('photo');
$frm->addDropdown('gender', array('' => '', 'male' => 'Male', 'female' => 'Female'));
$frm->addText('height')->setAttribute('placeholder', 'digits only');
$frm->addText('weight')->setAttribute('placeholder', 'digits only');
$frm->addDropdown('blood', array('' => '', 'O+' => 'O+', 'A+' => 'A+', 'B+' => 'B+', 'AB+' => 'AB+', 'O-' => 'O-', 'A-' => 'A-', 'B-' => 'B-', 'AB-' => 'AB-'));
$frm->addButton('submit', 'Submit');
//if form submitted
if ($frm->isSubmitted()) {
    $frm->getField('name')->isFilled('Please Fill in Client\'s Name.');
    if ($frm->getField('email')->isFilled()) {
        $frm->getField('email')->isEmail('Please provide a valid email address.');
コード例 #5
0
ファイル: form.php プロジェクト: jincongho/clienthub
/**
 * Set Company Value from string
 * 
 * @param SpoonForm $frm
 * @param string $value
 */
function setCompanyValue(&$frm, $value)
{
    $values = explode(', ', $value);
    $count = -1;
    for ($i = 1; $i < 6; $i++) {
        $frm->addText('company' . $i, $values[$count += 1])->setAttribute("placeholder", "公司名字 company name");
        $frm->addText('registerno' . $i, $values[$count += 1])->setAttribute("placeholder", "注册号码 registration number");
        $frm->addText('companyno' . $i, $values[$count += 1])->setAttribute("placeholder", "公司号码 Company number");
        $frm->addText('companyemail' . $i, $values[$count += 1])->setAttribute("placeholder", "公司电邮 Company email");
        $frm->addTextarea('shareholder' . $i, $values[$count += 1])->setAttribute("placeholder", "公司股东 Shareholder");
        $frm->addTextarea('registeraddr' . $i, $values[$count += 1])->setAttribute("placeholder", "注册地址 Registered Address");
        $frm->addTextarea('businessaddr' . $i, $values[$count += 1])->setAttribute("placeholder", "营业地址Business Address");
    }
}