当前位置: 首页>>代码示例>>PHP>>正文


PHP HTML_QuickForm2::addGroup方法代码示例

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


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

示例1: array

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(' ');
$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>');
/*
 * Process the form.
 */
// Remove 'space' first and last in all parameters.
$form->addRecursiveFilter('trim');
$mainTextHTML = "";
//If the page is correct filled in the update the DB.
if ($form->validate()) {
    //Wash the input.
    $formValues = $form->getValue();
    $nameAlbum = $dbAccess->WashParameter(strip_tags($formValues['name']));
开发者ID:GunnarWinqvist,项目名称:SSKL,代码行数:31,代码来源:PEditAlbum.php

示例2: array

    report_error($errors);
    $form = new HTML_QuickForm2('account-request-existingpackage', 'post', array('action' => 'account-request-existingpackage.php#requestform'));
    $form->removeAttribute('name');
    $renderer = new HTML_QuickForm2_Renderer_PEAR();
    $hsc = array_map('htmlspecialchars', $stripped);
    // Set defaults for the form elements
    $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('handle' => @$hsc['handle'], 'firstname' => @$hsc['firstname'], 'lastname' => @$hsc['lastname'], 'email' => @$hsc['email'], 'showemail' => @$hsc['showemail'], 'existingpackage' => @$hsc['existingpackage'], 'purpose' => @$hsc['purpose'], 'homepage' => @$hsc['homepage'], 'moreinfo' => @$hsc['moreinfo'], 'read_everything' => @$hsc['read_everything'])));
    $form->addElement('text', 'handle', array('placeholder' => 'psmith', 'maxlength' => "20", 'accesskey' => "r", 'required' => 'required'))->setLabel('Use<span class="accesskey">r</span>name:');
    $form->addElement('text', 'firstname', array('placeholder' => 'Peter', 'required' => 'required'))->setLabel('First Name:');
    $form->addElement('text', 'lastname', array('placeholder' => 'Smith', 'required' => 'required'))->setLabel('Last Name:');
    $form->addElement('password', 'password', array('size' => 10, 'required' => 'required'))->setLabel('Password:');
    $form->addElement('password', 'password2', array('size' => 10, 'required' => 'required'))->setLabel('Repeat Password:');
    $form->addElement('number', 'captcha', array('maxlength' => 4, 'required' => 'required'))->setLabel("What is " . $numeralCaptcha->getOperation() . '?');
    $_SESSION['answer'] = $numeralCaptcha->getAnswer();
    $form->addElement('email', 'email', array('placeholder' => 'you@example.com', 'required' => 'required'))->setLabel('Email Address:');
    $form->addElement('checkbox', 'showemail')->setLabel('Show email address?');
    $form->addElement('text', 'existingpackage', array('placeholder' => 'Category_PackageName', 'required' => 'required'))->setLabel('Package Name:');
    $invalid_purposes = array('Learn about PEAR.', 'Submit patches/bugs.', 'Suggest new features.', 'Download PEAR Packages.');
    $purpose = $form->addGroup('purposecheck')->setLabel('Purpose of your PEAR account:');
    $checkbox = array();
    foreach ($invalid_purposes as $i => $purposeKey) {
        $purpose->addElement('checkbox', $i, array('checked' => !empty($_POST['purposecheck'][$i]) ? 'checked' : ''))->setLabel($purposeKey);
    }
    $form->addElement('textarea', 'purpose', array('cols' => 40, 'rows' => 5, 'required' => 'required', 'placeholder' => 'I will improve...'))->setLabel('How will you help the package?');
    $form->addElement('url', 'homepage', array('placeholder' => 'http://example.com'))->setLabel('Homepage:' . '<p class="cell_note">(optional)</p>');
    $form->addElement('textarea', 'moreinfo', array('cols' => 40, 'rows' => 5, 'placeholder' => "I am a developer who has ..."))->setLabel('More relevant information about you:' . '<p class="cell_note">(optional)</p>');
    $form->addGroup('read_everything')->addElement('checkbox', 'comments_read', array('required' => 'required'))->setLabel('I have read EVERYTHING on this page');
    $form->addElement('submit', 'submit')->setLabel('Submit Request');
    print $form->render($renderer);
}
response_footer();
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:account-request-existingpackage.php

示例3: characters

<p>
 Note that this account can also be used to report a bug or comment on an existing bug.
</p>

<p>
Please use the &quot;latin counterparts&quot; of non-latin characters (for instance th instead of &thorn;).
</p>

MSG;
    echo '<a name="requestform" id="requestform"></a>';
    report_error($errors);
    $form = new HTML_QuickForm2('account-request-vote', 'post', array('action' => 'account-request-vote.php#requestform'));
    $form->removeAttribute('name');
    $renderer = new HTML_QuickForm2_Renderer_PEAR();
    $hsc = array_map('htmlspecialchars', $stripped);
    // Set defaults for the form elements
    $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('handle' => @$hsc['handle'], 'firstname' => @$hsc['firstname'], 'lastname' => @$hsc['lastname'], 'email' => @$hsc['email'], 'showemail' => @$hsc['showemail'], 'read_everything' => @$hsc['read_everything'])));
    $form->addElement('text', 'handle', array('placeholder' => 'psmith', 'maxlength' => "20", 'accesskey' => "r", 'required' => 'required'))->setLabel('Use<span class="accesskey">r</span>name:');
    $form->addElement('text', 'firstname', array('placeholder' => 'Peter', 'required' => 'required'))->setLabel('First Name:');
    $form->addElement('text', 'lastname', array('placeholder' => 'Smith', 'required' => 'required'))->setLabel('Last Name:');
    $form->addElement('password', 'password', array('size' => 10, 'required' => 'required'))->setLabel('Password:');
    $form->addElement('password', 'password2', array('size' => 10, 'required' => 'required'))->setLabel('Repeat Password:');
    $form->addElement('number', 'captcha', array('maxlength' => 4, 'required' => 'required'))->setLabel("What is " . $numeralCaptcha->getOperation() . '?');
    $_SESSION['answer'] = $numeralCaptcha->getAnswer();
    $form->addElement('email', 'email', array('placeholder' => 'you@example.com', 'required' => 'required'))->setLabel('Email Address:');
    $form->addElement('checkbox', 'showemail')->setLabel('Show email address?');
    $form->addGroup('read_everything')->addElement('checkbox', 'comments_read', array('required' => 'required'))->setLabel('I have read EVERYTHING on this page');
    $form->addElement('submit', 'submit')->setLabel('Submit Request');
    print $form->render($renderer);
}
response_footer();
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:account-request-vote.php

示例4: testGroup

 public function testGroup()
 {
     $value1 = array('foo' => 'foo');
     $value1F = array('foo' => 'F');
     $value2 = array('bar' => 'bar', 'baz' => array('quux' => 'baz'));
     $value2F = array('bar' => 'Bar', 'baz' => array('quux' => 'Baz'));
     $valueAnon = array('e1' => 'e1');
     $valueAnonF = array('e1' => '1');
     $formValue = array('g1' => $value1, 'g2' => array('i2' => $value2)) + $valueAnon;
     $formValueF = array('g1' => $value1F, 'g2' => array('i2' => $value2F)) + $valueAnonF;
     $form = new HTML_QuickForm2('testGroupGetValue');
     $form->addDataSource(new HTML_QuickForm2_DataSource_Array($formValue));
     $g1 = $form->addGroup('g1');
     $g1->addRecursiveFilter('strtoupper');
     $el1 = $g1->addText('foo');
     // Trim O *after* strtoupper
     $el1->addFilter('trim', array('O'));
     $g2 = $form->addGroup('g2[i2]');
     $g2->addRecursiveFilter('ucfirst');
     $g2->addText('bar');
     $g2->addText('baz[quux]');
     $anon = $form->addGroup();
     $anon->addText('e1');
     $anon->addRecursiveFilter('substr', array(1, 1));
     $this->assertEquals($formValueF, $form->getValue());
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:26,代码来源:FilterTest.php


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