• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP HTML_QuickForm2类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中HTML_QuickForm2的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm2类的具体用法?PHP HTML_QuickForm2怎么用?PHP HTML_QuickForm2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了HTML_QuickForm2类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testBug20295

 /**
  * If data source contains explicitly provided null values, those should be used
  * @link http://pear.php.net/bugs/bug.php?id=20295
  */
 public function testBug20295()
 {
     $form = new HTML_QuickForm2('bug20295');
     $hs = $form->addHierselect('hs')->loadOptions(array($this->_primary, $this->_secondary))->setValue(array(1, 12));
     $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('hs' => null)));
     $this->assertNull($hs->getValue());
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:11,代码来源:HierselectTest.php


示例2: testSetValueFromSubmitDataSource

 public function testSetValueFromSubmitDataSource()
 {
     $form = new HTML_QuickForm2('image', 'post', null, false);
     $foo = $form->appendChild(new HTML_QuickForm2_Element_InputImage('foo'));
     $bar = $form->appendChild(new HTML_QuickForm2_Element_InputImage('bar[idx]'));
     $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('foo_x' => '1234', 'foo_y' => '5678', 'bar' => array('idx' => array('98', '76')))));
     $this->assertEquals(array('x' => '12', 'y' => '34'), $foo->getValue());
     $this->assertEquals(array('x' => '56', 'y' => '78'), $bar->getValue());
     $foo->setAttribute('disabled');
     $this->assertNull($foo->getValue());
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:11,代码来源:InputImageTest.php


示例3: testSetValueFromSubmitDataSource

 public function testSetValueFromSubmitDataSource()
 {
     $form = new HTML_QuickForm2('submit', 'post', null, false);
     $foo = $form->appendChild(new HTML_QuickForm2_Element_InputSubmit('foo'));
     $bar = $form->appendChild(new HTML_QuickForm2_Element_InputSubmit('bar'));
     $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('foo' => 'Default for foo', 'bar' => 'Default for bar')));
     $this->assertEquals('A button clicked', $foo->getValue());
     $this->assertNull($bar->getValue());
     $foo->setAttribute('disabled');
     $this->assertNull($foo->getValue());
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:11,代码来源:InputSubmitTest.php


示例4: testGroupHiddens

 public function testGroupHiddens()
 {
     $form = new HTML_QuickForm2('testGroupHiddens', 'post', null, false);
     $hidden = $form->addHidden('aHiddenElement');
     $renderer = HTML_QuickForm2_Renderer::factory('stub');
     $renderer->setOption('group_hiddens', false);
     $form->render($renderer);
     $this->assertEquals(array(), $renderer->getHidden());
     $renderer->setOption('group_hiddens', true);
     $form->render($renderer);
     $this->assertEquals(array($hidden->__toString()), $renderer->getHidden());
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:12,代码来源:StubTest.php


示例5: addElement

 /**
  * Wrapper around HTML_QuickForm2_Container's addElement()
  *
  * @param    string|HTML_QuickForm2_Node  Either type name (treated
  *               case-insensitively) or an element instance
  * @param    mixed   Element name
  * @param    mixed   Element attributes
  * @param    array   Element-specific data
  * @return   HTML_QuickForm2_Node     Added element
  * @throws   HTML_QuickForm2_InvalidArgumentException
  * @throws   HTML_QuickForm2_NotFoundException
  */
 public function addElement($elementOrType, $name = null, $attributes = null, array $data = array())
 {
     if ($name != 'submit') {
         $this->a_formElements[] = $name;
     }
     return parent::addElement($elementOrType, $name, $attributes, $data);
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:19,代码来源:QuickForm2.php


示例6: testPerform

 public function testPerform()
 {
     $formOne = new HTML_QuickForm2('formOne');
     $formOne->addElement('text', 'foo')->setValue('foo value');
     $pageOne = $this->getMock('HTML_QuickForm2_Controller_Page', array('populateForm'), array($formOne));
     $formTwo = new HTML_QuickForm2('formTwo');
     $formTwo->addElement('text', 'bar')->setValue('bar value');
     $pageTwo = $this->getMock('HTML_QuickForm2_Controller_Page', array('populateForm'), array($formTwo));
     $mockJump = $this->getMock('HTML_QuickForm2_Controller_Action', array('perform'));
     $mockJump->expects($this->exactly(2))->method('perform')->will($this->returnValue('jump to foo'));
     $pageOne->addHandler('jump', $mockJump);
     $controller = new HTML_QuickForm2_Controller('testBackAction');
     $controller->addPage($pageOne);
     $controller->addPage($pageTwo);
     $this->assertEquals('jump to foo', $pageTwo->handle('back'));
     $this->assertEquals(array(), $controller->getSessionContainer()->getValues('formOne'));
     $this->assertContains('bar value', $controller->getSessionContainer()->getValues('formTwo'));
     $this->assertEquals('jump to foo', $pageOne->handle('back'));
     $this->assertContains('foo value', $controller->getSessionContainer()->getValues('formOne'));
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:20,代码来源:BackTest.php


示例7: renderForm

    protected function renderForm(HTML_QuickForm2 $form)
    {
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <style type="text/css">
/* Set up custom font and form width */
body {
    margin-left: 10px;
    font-family: Arial,sans-serif;
    font-size: small;
}

.quickform {
    min-width: 500px;
    max-width: 600px;
    width: 560px;
}

.separator {
    float: left;
    margin: 0.7em 0 0 0.1em;
}

/* Use default styles included with the package */

<?php 
        if ('@data_dir@' != '@' . 'data_dir@') {
            $filename = '@data_dir@/HTML_QuickForm2/quickform.css';
        } else {
            $filename = dirname(dirname(dirname(__FILE__))) . '/data/quickform.css';
        }
        readfile($filename);
        ?>
    </style>
    <title>HTML_QuickForm2 basic elements example</title>
  </head>
  <body>
<?php 
        $renderer = HTML_QuickForm2_Renderer::factory('default');
        $renderer->setElementTemplateForGroupId('nameGrp', 'html_quickform2_element', '<div class="element<qf:error> error</qf:error>"><qf:error><span class="error">{error}</span><br /></qf:error>{element}<br /><label for="{id}"><qf:required><span class="required">* </span></qf:required>{label}</label></div>');
        $renderer->setTemplateForId('nameGrp', '<div class="row"><p class="label"><qf:required><span class="required">*</span></qf:required><qf:label><label>{label}</label></qf:label></p>{content}</div>');
        echo $form->render($renderer);
        ?>
  </body>
</html>
<?php 
    }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:50,代码来源:wizard.php


示例8: __construct

 public function __construct($id, $values, $action)
 {
     parent::__construct($id);
     $this->naziv = new HTML_QuickForm2_Element_InputText('naziv');
     $this->naziv->setAttribute('size', "100%");
     $this->naziv->setLabel('Naziv:');
     $this->naziv->setValue($values["naziv"]);
     $this->naziv->addRule('required', 'Vnesite naziv.');
     $this->naziv->addRule('regex', 'Pri imenu uporabite le črke, številke, narekovaje ali ločila.', '/^[a-zA-Zšč枊ČĆŽ0-9\'\\"-.,;! ]+$/');
     $this->naziv->addRule('maxlength', 'Ime naj bo krajše od 80 znakov.', 80);
     $this->cena = new HTML_QuickForm2_Element_InputText('cena');
     $this->cena->setAttribute('size', "100%");
     $this->cena->setLabel('Cena:');
     $this->cena->setValue($values["cena"]);
     $this->cena->addRule('required', 'Vnesite ceno.');
     $this->cena->addRule('regex', 'Pri ceni uporabite le številke in piko za decimalne zapise.', '/^[0-9.]+$/');
     $this->cena->addRule('maxlength', 'Cena naj bo krajši od 10 znakov.', 10);
     $this->opis = new HTML_QuickForm2_Element_Textarea('opis');
     $this->opis->setAttribute('rows', 5);
     $this->opis->setAttribute('cols', "98%");
     $this->opis->setLabel('Opis:');
     $this->opis->setValue($values["opis"]);
     $this->opis->addRule('required', 'Vnesite opis.');
     $this->opis->addRule('maxlength', 'Opis naj bo krajši od 250 znakov.', 250);
     if ($action != "profil") {
         $this->aktiven = new HTML_QuickForm2_Element_InputCheckbox('aktiven');
         $this->aktiven->setLabel('Aktiven izdelek:');
         if (isset($values["aktiven"]) && $values["aktiven"] == "da") {
             $this->aktiven->setValue(1);
         }
     }
     $this->gumb = new HTML_QuickForm2_Element_InputSubmit(null);
     if ($action == "dodajanje") {
         $this->gumb->setAttribute('value', 'Ustvari izdelek');
     } elseif ($action == "profil") {
         $this->gumb->setAttribute('value', 'Spremeni');
     } else {
         $this->gumb->setAttribute('value', 'Spremeni izdelek');
     }
     $this->addElement($this->naziv);
     $this->addElement($this->cena);
     $this->addElement($this->opis);
     if ($action != "profil") {
         $this->addElement($this->aktiven);
     }
     $this->addElement($this->gumb);
     $this->addRecursiveFilter('trim');
     $this->addRecursiveFilter('htmlspecialchars');
 }
开发者ID:benjaminovak,项目名称:ep,代码行数:49,代码来源:ProductForm.php


示例9: printForm

function printForm($data = array())
{
    foreach (array('name', 'email', 'copy_me', 'subject', 'text') as $value) {
        if (!isset($data[$value])) {
            $data[$value] = '';
        }
    }
    $form = new HTML_QuickForm2('contect', 'post', array('action' => '/account-mail.php?handle=' . htmlspecialchars($_GET['handle'])));
    $form->removeAttribute('name');
    // Set defaults for the form elements
    $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('name' => htmlspecialchars($data['name']), 'email' => htmlspecialchars($data['email']), 'copy_me' => htmlspecialchars($data['copy_me']), 'subject' => htmlspecialchars($data['subject']), 'text' => htmlspecialchars($data['text']))));
    $form->addElement('text', 'name', array('required' => 'required'))->setLabel('Y<span class="accesskey">o</span>ur Name:', 'size="40" accesskey="o"');
    $form->addElement('email', 'email', array('required' => 'required'))->setLabel('Email Address:');
    $form->addElement('checkbox', 'copy_me')->setLabel('CC me?:');
    $form->addElement('text', 'subject', array('required' => 'required', 'size' => '80'))->setLabel('Subject:');
    $form->addElement('textarea', 'text', array('cols' => 80, 'rows' => 10, 'required' => 'required'))->setLabel('Text:');
    if (!auth_check('pear.dev')) {
        $numeralCaptcha = new Text_CAPTCHA_Numeral();
        $form->addElement('number', 'captcha', array('maxlength' => 4, 'required' => 'required'))->setLabel("What is " . $numeralCaptcha->getOperation() . '?');
        $_SESSION['answer'] = $numeralCaptcha->getAnswer();
    }
    $form->addElement('submit', 'submit')->setLabel('Send Email');
    print $form;
}
开发者ID:stof,项目名称:pearweb,代码行数:24,代码来源:account-mail.php


示例10: testBug20295

 /**
  * If data source contains explicitly provided null values, those should be used
  * @link http://pear.php.net/bugs/bug.php?id=20295
  */
 public function testBug20295()
 {
     $form = new HTML_QuickForm2('bug20295');
     $el = $form->appendChild(new HTML_QuickForm2_ElementImpl('foo'));
     $el->setValue('not empty');
     $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('foo' => null)));
     $this->assertNull($el->getValue());
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:12,代码来源:ElementTest.php


示例11: _renderRequiredNote

 public static function _renderRequiredNote(HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2 $form)
 {
     if ($renderer->hasRequired && !$form->toggleFrozen(null)) {
         if (($note = $renderer->getOption('required_note')) && !empty($note)) {
             return '<div class="alert alert-info">' . $note . '</div>';
         }
     }
 }
开发者ID:sergiokessler,项目名称:perio,代码行数:8,代码来源:Callback.php


示例12: testBug20295

 /**
  * If defaults contain null values, previous values are reused
  * @link http://pear.php.net/bugs/bug.php?id=20295
  */
 public function testBug20295()
 {
     $form = new HTML_QuickForm2('repeat-bug');
     $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('buggy' => array('name' => array(1 => 'First', 2 => 'Second'), 'extra' => array(1 => 'Has extra', 2 => null)))));
     $group = new HTML_QuickForm2_Container_Group('buggy');
     $group->addText('name');
     $group->addText('extra');
     $repeat = $form->addRepeat(null, array('id' => 'buggy-repeat'), array('prototype' => $group));
     $value = $repeat->getValue();
     $this->assertEquals('', $value['buggy']['extra'][2]);
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:15,代码来源:RepeatTest.php


示例13: HTML_QuickForm2

{
	include('installheader.php');
?>
	<p>Before continuing with the installation, please ensure install/ and includes/ are writable. (<code>chmod -Rv 777 <?=dirname(__FILE__)?> <?=dirname(dirname(__FILE__))?>/includes/</code>)</p>
<?
	include('installfooter.php');
	ob_flush();
	exit(0);
}

if(intval($_GET['page'])==0)
{
	//include('../lib/recaptchalib.php');
	//$recaptchaurl = recaptcha_get_signup_url (null,"FlexCP");
	
	$form = new HTML_QuickForm2('frmInstall');
	$form->addDataSource(new HTML_QuickForm2_DataSource_Array(array(
	    	'txtSiteURL'		=> 'http://'.$_SERVER['HTTP_HOST'].'/',
	    	'txtSitePath'     	=> dirname(dirname(__FILE__)).'/',
		'txtAdminName'		=> 'Sysop',
		'txtSQLHost'		=> 'localhost',
		'txtSQLPrefix'		=> 'atbbs_',
	)));
	$fsMain = $form->addElement('fieldset')->setLabel('Main ATBBS Configuration');

	$sitename	= $fsMain->addElement('text','txtSiteName',	array(),array('label'=>'BBS\'s Name:'));
	$siteurl	= $fsMain->addElement('text','txtSiteURL',	array(),array('label'=>'Site URL:'));
	$sitepath	= $fsMain->addElement('text','txtSitePath',	array(),array('label'=>'Full path to site folder:'));
	$siteemail	= $fsMain->addElement('text','txtSiteEmail',	array(),array('label'=>'Email shown in automails, in the From: header:'));
	$siteadminname  = $fsMain->addElement('text','txtAdminName',	array(),array('label'=>'Used in place of Anonymous when an admin posts:'));
开发者ID:N3X15,项目名称:ATBBS-Plus,代码行数:30,代码来源:index.php


示例14: testSelectMultipleNoOptionsSelectedOnSubmit

 public function testSelectMultipleNoOptionsSelectedOnSubmit()
 {
     $options = array('1' => 'Option 1', '2' => 'Option 2');
     $formPost = new HTML_QuickForm2('multiple', 'post', null, false);
     $single1 = $formPost->appendChild(new HTML_QuickForm2_Element_Select('single1', null, array('options' => $options)));
     $single2 = $formPost->appendChild(new HTML_QuickForm2_Element_Select('single2', null, array('options' => $options)));
     $multiple = $formPost->appendChild(new HTML_QuickForm2_Element_Select('mult', array('multiple'), array('options' => $options)));
     $this->assertEquals('1', $single1->getValue());
     $this->assertNull($single2->getValue());
     $this->assertNull($multiple->getValue());
     $formPost->addDataSource(new HTML_QuickForm2_DataSource_Array(array('single1' => '2', 'single2' => '2', 'mult' => array('1', '2'))));
     $this->assertEquals('1', $single1->getValue());
     $this->assertEquals('2', $single2->getValue());
     $this->assertNull($multiple->getValue());
     $formGet = new HTML_QuickForm2('multiple2', 'get', null, false);
     $multiple2 = $formGet->appendChild(new HTML_QuickForm2_Element_Select('mult2', array('multiple'), array('options' => $options)));
     $this->assertNull($multiple2->getValue());
     $formGet->addDataSource(new HTML_QuickForm2_DataSource_Array(array('mult2' => array('1', '2'))));
     $this->assertEquals(array('1', '2'), $multiple2->getValue());
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:20,代码来源:SelectTest.php


示例15: HTML_Table

    if (count($user_karma) == 0) {
        echo 'No karma yet';
    } else {
        $table = new HTML_Table('style="width: 90%"');
        $table->setCaption('Karma levels for ' . htmlspecialchars($handle), 'style="background-color: #CCCCCC;"');
        $table->addRow(array("Level", "Added by", "Added at", "Remove"), null, 'th');
        foreach ($user_karma as $item) {
            $remove = sprintf("karma.php?action=remove&amp;handle=%s&amp;level=%s", htmlspecialchars($handle), htmlspecialchars($item['level']));
            $table->addRow(array(htmlspecialchars($item['level']), htmlspecialchars($item['granted_by']), htmlspecialchars($item['granted_at']), make_link($remove, make_image("delete.gif"), false, 'onclick="javascript:return confirm(\'Do you really want to remove the karma level ' . htmlspecialchars($item['level']) . '?\');"')));
        }
        echo $table->toHTML();
    }
    echo "<br /><br />";
    $table = new HTML_Table('style="width: 100%"');
    $table->setCaption("Grant karma to " . htmlspecialchars($handle), 'style="background-color: #CCCCCC;"');
    $form = new HTML_QuickForm2('karma_grant', 'post', array('action' => 'karma.php?action=grant'));
    $form->removeAttribute('name');
    $form->addElement('text', 'level')->setLabel('Level:&nbsp;');
    $form->addElement('hidden', 'handle')->setValue(htmlspecialchars($handle));
    $form->addElement('submit', 'submit')->setLabel('Submit Changes');
    $csrf_token_value = create_csrf_token($csrf_token_name);
    $form->addElement('hidden', $csrf_token_name)->setValue($csrf_token_value);
    $table->addRow(array((string) $form));
    echo $table->toHTML();
}
echo "<p>&nbsp;</p><hr />";
$table = new HTML_Table('style="width: 90%"');
$table->setCaption("Karma Statistics", 'style="background-color: #CCCCCC;"');
if (!empty($_GET['a']) && $_GET['a'] == "details" && !empty($_GET['level'])) {
    $table->addRow(array('Handle', 'Granted'), null, 'th');
    foreach ($karma->getUsers($_GET['level']) as $user) {
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:karma.php


示例16: array

    $lista_select[$row['k']] = $row['v'];
}
$urna_select = array('' => '-- seleccione --');
$urna_select_sql = 'select urna_id as k, urna_nombre as v from urna order by urna_nombre';
$urna_select_sql_data = array();
$st = $db->prepare($urna_select_sql);
$st->execute($urna_select_sql_data);
while ($row = $st->fetch(PDO::FETCH_ASSOC)) {
    $urna_select[$row['k']] = $row['v'];
}
$form_params = params_encode($params);
$form_update = false;
if (isset($record_id)) {
    $form_update = true;
}
$form = new HTML_QuickForm2('form', 'post', array('role' => 'form'));
if ($form_update and empty($_POST)) {
    $db = new PDO($db_dsn, $db_user, $db_pass);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
    $st = $db->prepare("select * from {$this_table} where {$this_primary_key} = ?");
    $st->execute(array($record_id));
    $edit_row = $st->fetch(PDO::FETCH_ASSOC);
    $defaults['new_row'] = $edit_row;
    $form->addDataSource(new HTML_QuickForm2_DataSource_Array($defaults));
}
// elements
$form->addElement('hidden', 'action')->setValue($this_action);
$form->addElement('hidden', 'params')->setValue($form_params);
$form->addElement('select', 'new_row[urna_id]', array('autofocus' => 'autofocus'))->setLabel('Urna:')->loadOptions($urna_select)->addRule('required', 'Valor requerido');
$form->addElement('select', 'new_row[lista_id]')->setLabel('Lista:')->loadOptions($lista_select)->addRule('required', 'Valor requerido');
开发者ID:sergiokessler,项目名称:perio,代码行数:31,代码来源:urna_total_form.php


示例17: testValidateChecksWhetherFormIsSubmitted

 public function testValidateChecksWhetherFormIsSubmitted()
 {
     $form1 = new HTML_QuickForm2('notrack', 'post');
     $this->assertFalse($form1->validate());
     $form2 = new HTML_QuickForm2('track', 'post');
     $this->assertTrue($form2->validate());
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:7,代码来源:QuickForm2Test.php


示例18: HTML_QuickForm2

      .quickform div.errors p,
      .quickform div.errors ul { margin:0; }
      .quickform div.error input { border-color: #C00; background-color: #FEF; }
      .quickform div.qf-checkable label,
      .quickform div.qf-checkable input { display: inline; float: none; }
      .quickform div.qf-checkable div,
      .quickform div.qf-message { margin-left: 170px; }
      .quickform div.qf-message { font-size: 88%; color: #C00; }
    </style>
    <title>HTML_QuickForm2 default renderer example</title>
  </head>
  <body>
<?php 
require_once 'HTML/QuickForm2.php';
require_once 'HTML/QuickForm2/Renderer.php';
$form = new HTML_QuickForm2('example');
$fs = $form->addFieldset()->setLabel('Your information');
$username = $fs->addText('username')->setLabel('Username');
$username->addRule('required', 'Username is required');
$password = $fs->addPassword('pass')->setLabel(array('Password', 'Password should be 8 characters at minimum'));
$password->addRule('required', 'Password is required');
$form->addHidden('my_hidden1')->setValue('1');
$form->addHidden('my_hidden2')->setValue('2');
$form->addSubmit('submit', array('value' => 'Send', 'id' => 'submit'));
if ($form->validate()) {
    $form->toggleFrozen(true);
}
$renderer = HTML_QuickForm2_Renderer::factory('default')->setOption(array('group_hiddens' => true, 'group_errors' => true, 'required_note' => '<strong>Note:</strong> Required fields are marked with an asterisk (<em>*</em>).'))->setTemplateForId('submit', '<div class="element">{element} or <a href="/">Cancel</a></div>')->setTemplateForClass('HTML_QuickForm2_Element_Input', '<div class="element<qf:error> error</qf:error>"><qf:error>{error}</qf:error>' . '<label for="{id}" class="qf-label<qf:required> required</qf:required>">{label}</label>' . '{element}' . '<qf:label_2><div class="qf-label-1">{label_2}</div></qf:label_2></div>');
echo $form->render($renderer);
?>
</body>
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:31,代码来源:default-renderer.php


示例19: die

 * If $nextPage is not set, the page is not reached via the page controller.
 * Then check if the viewer is signed in.
 */
if (!isset($nextPage)) {
    die('Direct access to the page is not allowed.');
}
/*
 * Generera formuläret med QuickForm2.
 */
require_once 'HTML/QuickForm2.php';
require_once 'HTML/QuickForm2/Renderer.php';
// Alternativ för nationalitet.
$options = array('--' => '--', 'se' => 'Svensk', 'no' => 'Norsk', 'dk' => 'Dansk', 'fi' => 'Finsk', 'nn' => 'Annan');
$formAction = WS_SITELINK . "?p=appl";
// Pekar tillbaka på samma sida igen.
$form = new HTML_QuickForm2('application', 'post', array('action' => $formAction), array('name' => 'application'));
// data source with default values:
$form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('personnummerElev' => 'ååååmmdd-nnnn', 'stadsdelBostad' => 'Mont Kiara, Ampang, ...', 'stadBostad' => 'Kuala Lumpur', 'statBostad' => 'Kuala Lumpur, Selangor, ...', 'skolaElev' => 'MKIS, ISKL, ...')));
// Data för eleven
$fsElev = $form->addElement('fieldset')->setLabel('Eleven');
$fornamnPerson = $fsElev->addElement('text', 'fornamnPerson', array('style' => 'width: 300px;'), array('label' => 'Förnamn:'));
$fornamnPerson->addRule('required', 'Fyll i elevens förnamn');
$fornamnPerson->addRule('maxlength', 'Elevens förnamn får max vara 50 tecken.', 50);
$efteramnPerson = $fsElev->addElement('text', 'efternamnPerson', array('style' => 'width: 300px;'), array('label' => 'Efternamn:'));
$efteramnPerson->addRule('required', 'Fyll i elevens efternamn');
$efteramnPerson->addRule('maxlength', 'Elevens efternamn får max vara 50 tecken.', 50);
$nationalitetElev = $fsElev->addElement('select', 'nationalitetElev', null, array('options' => $options, 'label' => 'Nationalitet:'));
$personnummerElev = $fsElev->addElement('text', 'personnummerElev', array('style' => 'width: 300px;'), array('label' => 'Personnummer:'));
$personnummerElev->addRule('required', 'Fyll i elevens personnummer eller födelsedatum.');
$personnummerElev->addRule('regex', 'Personnumret måste ha formen ååååmmdd-nnnn. Födelsedatum formen ååååmmdd.', '/^(19|20)\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])(-\\d{4})?$/');
$kommentar = $fsElev->addElement('static', 'comment')->setContent('Fyll i svenskt personnummer om eleven har det, annars 
开发者ID:GunnarWinqvist,项目名称:SSKL,代码行数:31,代码来源:PApplication.php


示例20: array

    $result = $dbAccess->SingleQuery($query);
    $arrayAlbum = $result->fetch_row();
    $result->close();
} else {
    // Clear all parameters if a new user will be created.
    $arrayAlbum = array("", "", "", "", "", "", "");
}
/*
 * Create the form with QuickForm2.
 */
require_once 'HTML/QuickForm2.php';
require_once 'HTML/QuickForm2/Renderer.php';
// Point back to the same page for validation.
$formAction = WS_SITELINK . "?p=edit_alb&id=" . $idAlbum;
// Create a new form object.
$form = new HTML_QuickForm2('album', 'post', array('action' => $formAction), array('name' => 'album'));
// Data source with default values:
$form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('name' => $arrayAlbum[2], 'description' => $arrayAlbum[3])));
// Album info.
$fsAlbum = $form->addElement('fieldset')->setLabel('Album');
$nameAlbum = $fsAlbum->addElement('text', 'name', array('style' => 'width: 300px;'), array('label' => 'Namn'));
$nameAlbum->addRule('required', 'Fyll i namn på albumet');
$nameAlbum->addRule('maxlength', 'Namnet är för långt för databasen.', 100);
$descriptionAlbum = $fsAlbum->addElement('textarea', 'description', array('style' => 'width: 300px;'), array('label' => 'Beskrivning'));
// Buttons
$buttons = $form->addGroup('buttons')->setSeparator('&nbsp;');
$buttons->addElement('image', 'submitButton', array('src' => 'images/b_enter.gif', 'title' => 'Spara'));
$buttons->addElement('static', 'resetButton')->setContent('<a title="Återställ" href="?p=edit_alb&amp;id=' . $idAlbum . '" ><img src="images/b_undo.gif" alt="Återställ" /></a>');
$buttons->addElement('static', 'cancelButton')->setContent('<a title="Avbryt" href="?p=' . $redirect . '" >
        <img src="images/b_cancel.gif" alt="Avbryt" /></a>');
/*
开发者ID:GunnarWinqvist,项目名称:SSKL,代码行数:31,代码来源:PEditAlbum.php



注:本文中的HTML_QuickForm2类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP HTML_QuickForm2_Renderer类代码示例发布时间:2022-05-23
下一篇:
PHP HTML_QuickForm类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap