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


PHP HTML_QuickForm::removeAttribute方法代码示例

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


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

示例1: dirname

/**
 * Renvoit l'instance d'un formulaire
 *
 * Un formulaire est instancié, configuré puis renvoyé
 *
 * @param   string  $url        URL pour l'attribut "action" du formulaire
 * @param   string  $nom        Nom du formulaire
 * @return  object
 */
function &instancierFormulaire($url = null, $nom = 'formulaire')
{
    if (is_null($url)) {
        $url = $_SERVER['REQUEST_URI'];
    }
    require_once dirname(__FILE__) . '/../../dependencies/PEAR/HTML/QuickForm.php';
    require_once dirname(__FILE__) . '/../../dependencies/PEAR/HTML/QuickForm/altselect.php';
    $formulaire = new HTML_QuickForm($nom, 'post', $url);
    $formulaire->removeAttribute('name');
    return $formulaire;
}
开发者ID:fferriere,项目名称:web,代码行数:20,代码来源:fonctions.php

示例2: die

<?php

// no direct access
defined('PARENT_FILE') or die('Restricted access');
if ($this->authorize()) {
    $menuBar = array('cancel' => '/ushop/tax/overview', 'save' => null);
    $this->content .= $this->makeToolbar($menuBar, 24);
    $menuBar = array();
    $rows = $this->getResult('tax_code_id, tax_rate_id, tax_code, description', $ushop->db_name . 'tax_codes', null, array('where' => 'tax_code_id = ' . $this->registry->params['id']));
    $form = new HTML_QuickForm('edit_tax_code', 'post', $_SERVER['REQUEST_URI']);
    // Remove name attribute for xhtml strict compliance.
    $form->removeAttribute('name');
    $s = $form->createElement('select', 'tax_rate_id', 'Tax Rate:');
    $opts[0] = 'Select One';
    $tax_rates = $ushop->getTaxRates(true);
    foreach ($tax_rates as $rate) {
        $opts[$rate->tax_rate_id] = ucwords($rate->tax_rate);
    }
    $form->addElement('html', '<fieldset>');
    $form->addElement('header', 'edit_tax_code', 'Edit Tax Code');
    $form->addElement('text', 'tax_code', 'Tax Code:', array('size' => 2, 'maxlength' => 2, 'class' => 'inputbox'));
    $s->loadArray($opts);
    $form->addElement($s);
    $form->addElement('text', 'description', 'Description:', array('size' => 20, 'maxlength' => 20, 'class' => 'inputbox'));
    $form->addElement('html', '</fieldset>');
    $form->addRule('description', 'Please enter a decription', 'required');
    $form->addRule('tax_code', 'Please enter a tax code', 'required');
    $form->addRule('tax_code', 'Tax codes have only letters', 'lettersonly');
    if ($form->validate()) {
        $form->freeze();
        $values = $form->process(array(&$this, 'formValues'), false);
开发者ID:Rem122,项目名称:Uthando-CMS,代码行数:31,代码来源:edit_tax_code.php

示例3: _customDisplay

    /**
     * Remplit le layer de customisation des grids.
     *
     * @param object $tpl instanceof Template
     * @access private
     * @return void
     */
    private function _customDisplay($tpl)
    {
        require_once 'HTML/QuickForm.php';
        require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
        require_once 'HTML/QuickForm/advmultiselect.php';
        $renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl);
        $form = new HTML_QuickForm('gridCustomDisplay', 'post', $_SERVER['PHP_SELF']);
        $form->removeAttribute('name');
        // XHTML compliance
        $defaultValues = array();
        // Valeurs par defaut des champs du form
        $form->updateAttributes(array('onsubmit' => "return checkBeforeSubmit();"));
        //$form->updateAttributes(array('onsubmit' => '$(\'customDisplayUpdated\').value=1;'));
        $form->addElement('hidden', 'customDisplayUpdated', '0');
        // Les plus souvent utilises
        $nbItemsArray = array(30 => 30, 50 => 50, 100 => 100, 150 => 150, 200 => 200, 300 => 300, 500 => 500);
        if ($this->paged) {
            $defaultItemPerPage = $this->itemPerPage;
            if (!in_array($defaultItemPerPage, $nbItemsArray)) {
                $nbItemsArray[$defaultItemPerPage] = $defaultItemPerPage;
                sort($nbItemsArray);
            }
            $form->addElement('select', 'customDisplayItemPerPage', _('Items number per page'), $nbItemsArray);
            // ToDo: MODIFIER en fction des saisies!!
            $defaultValues['customDisplayItemPerPage'] = $defaultItemPerPage;
        }
        $cols = array();
        foreach ($this->columns as $colIndex => $column) {
            // Groupement de colonnes: toDo?
            // $column->groupCaption . ' ' . $column->title;
            if (!$column->enabled || $column->groupCount) {
                // On n'affiche que les column actives et
                continue;
            }
            // Pour la gestion des sous-grids, on nettoie l'entete
            $cols[$colIndex] = stripos($column->title, '</td><td>') !== false ? substr(str_replace('</td><td>', ', ', $column->title), 2, -2) : $column->title;
        }
        $labels = array(_('Columns') . ':', _('Available columns'), _('Columns to hide'));
        $elt = HTML_QuickForm::createElement('advmultiselect', 'customDisplayHiddenColumns', $labels, $cols, array('style' => 'width:100%;'));
        // Necessaire pour externaliser la tonne de js, si include js trouve
        $js = file_exists('JS_AdvMultiSelect.php') ? '' : '{javascript}';
        $jsValidation = '<script type="text/javascript">
                //<![CDATA[
            function checkBeforeSubmit() {
                if ($(\'__customDisplayHiddenColumns\').options.length == 0) {
                    alert("' . _("You can't hide all columns.") . '");
                    return false;
                }
                return true;
            }

            //]]>
             </script>';
        $eltTemplate = $js . $jsValidation . '
            <table{class}>
              <tr><th>{label_2}</th><th>&nbsp;</th><th>{label_3}</th></tr>
            <tr>
              <td valign="top">{unselected}</td>
              <td align="center">{add}{remove}</td>
              <td valign="top">{selected}</td>
            </tr>
            </table>
            ';
        $elt->setElementTemplate($eltTemplate);
        $form->addElement($elt);
        $form->addElement('submit', 'customDisplaySubmit', A_VALIDATE, 'onclick="this.form.customDisplayUpdated.value=1;"');
        /*$form->addElement('button', 'customDisplaySetDefault', _('Default values'),
          'onclick="fw.dom.selectOptionByValue($(\'customDisplayColumns\'), '
              . JsTools::JSArray($nbItemsArray) . ');this.form.submit();"');
              $(\'customDisplayUpdated\').value=1*/
        $form->addElement('button', 'customDisplayCancel', A_CANCEL, 'onclick="fw.dom.toggleElement($(\'custom_display_layer\'));"');
        $defaultValues['customDisplayHiddenColumns'] = $this->hiddenColumnsByUser;
        $form->setDefaults($defaultValues);
        // PATCH car advmultiselect buggé!!
        $elt->_values = $defaultValues['customDisplayHiddenColumns'];
        // end PATCH
        $form->accept($renderer);
        // affecte au form le renderer personnalise
        $tpl->assign('form', $renderer->toArray());
    }
开发者ID:arhe,项目名称:pwak,代码行数:87,代码来源:Grid.php

示例4: addElements

<?php

require_once "common.inc.php";
require_once "HTML/QuickForm.php";
require_once "HTML/QuickForm/Renderer/Tableless.php";
$form = new HTML_QuickForm("", "post", "register.php", "", array("style" => "width: 30em;"), true);
$form->removeAttribute("name");
addElements($form);
addRules($form);
$form->setRequiredNote("");
if ($form->isSubmitted() and $form->validate()) {
    $form->process("processForm");
    displayThanks();
} else {
    displayPageHeader("Sign up for the book club!");
    ?>
    <p>Thanks for choosing to join our book club.</p>
    <p>To register, please fill in your details below and click Send Details.</p>
    <p>Fields marked with an asterisk (*) are required.</p>
<?php 
    $renderer = new HTML_QuickForm_Renderer_Tableless();
    $form->accept($renderer);
    echo $renderer->toHtml();
    displayPageFooter();
}
function addElements($form)
{
    $form->addElement("text", "username", "Choose a username");
    $password1 = $form->addElement("password", "password1", "Choose a password");
    $password1->setValue("");
    $password2 = $form->addElement("password", "password2", "Retype password");
开发者ID:raynaldmo,项目名称:php-education,代码行数:31,代码来源:register.php

示例5: _customDisplay

    /**
     * Remplit le layer de customisation des searchforms.
     *
     * @param object $tpl instanceof Template
     * @access private
     * @return void
     */
    private function _customDisplay($tpl)
    {
        require_once 'HTML/QuickForm.php';
        require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
        require_once 'HTML/QuickForm/advmultiselect.php';
        $renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl);
        $form = new HTML_QuickForm('CustomSearch', 'post', $_SERVER['PHP_SELF']);
        $form->removeAttribute('name');
        // XHTML compliance
        $defaultValues = array();
        // Valeurs par defaut des champs du form
        $form->updateAttributes(array('onsubmit' => "return checkBeforeSubmit();"));
        $form->addElement('hidden', 'customSearchUpdated', '0');
        $criteria = array();
        foreach ($this->_elementsToDisplay as $elementName => $type) {
            if ($type == 'blank' || substr($type, 0, 4) == 'date') {
                continue;
            }
            $criteria[$elementName] = $this->_form->getElement($elementName)->getLabel();
        }
        $labels = array(_('criteria') . ':', _('Available criteria'), _('Criteria to hide'));
        $elt = HTML_QuickForm::createElement('advmultiselect', 'customSearchHiddenCriteria', $labels, $criteria, array('style' => 'width:100%;'));
        // Necessaire pour externaliser la tonne de js, si include js trouve
        $js = file_exists('JS_AdvMultiSelect.php') ? '' : '{javascript}';
        $jsValidation = '<script type="text/javascript">
                //<![CDATA[
            function checkBeforeSubmit() {
                if ($(\'__customSearchHiddenCriteria\').options.length == 0) {
                    alert("' . _("You can't hide all criteria.") . '");
                    return false;
                }
                return true;
            }

            //]]>
             </script>';
        $eltTemplate = $js . $jsValidation . '
            <table{class}>
              <tr><th>{label_2}</th><th>&nbsp;</th><th>{label_3}</th></tr>
            <tr>
              <td valign="top">{unselected}</td>
              <td align="center">{add}{remove}</td>
              <td valign="top">{selected}</td>
            </tr>
            </table>
            ';
        $elt->setElementTemplate($eltTemplate);
        $form->addElement($elt);
        $form->addElement('submit', 'customSearchSubmit', A_VALIDATE, 'onclick="this.form.customSearchUpdated.value=1;"');
        $form->addElement('button', 'customSearchCancel', A_CANCEL, 'onclick="fw.dom.toggleElement($(\'custom_search_layer\'));"');
        $defaultValues['customSearchHiddenCriteria'] = $this->hiddenCriteriaByUser;
        $form->setDefaults($defaultValues);
        // PATCH car advmultiselect buggé!!
        $elt->_values = $defaultValues['customSearchHiddenCriteria'];
        // end PATCH
        $form->accept($renderer);
        // affecte au form le renderer personnalise
        $tpl->assign('customSearchForm', $renderer->toArray());
    }
开发者ID:arhe,项目名称:pwak,代码行数:66,代码来源:SearchForm.php


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