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


PHP FormDisplay::displayErrors方法代码示例

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


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

示例1: testDisplayErrors

 /**
  * Test for FormDisplay::displayErrors
  *
  * @return void
  */
 public function testDisplayErrors()
 {
     $reflection = new \ReflectionClass('FormDisplay');
     $attrIsValidated = $reflection->getProperty('_isValidated');
     $attrIsValidated->setAccessible(true);
     $attrIsValidated->setValue($this->object, true);
     $attrIsValidated = $reflection->getProperty('_errors');
     $attrIsValidated->setAccessible(true);
     $attrIsValidated->setValue($this->object, array());
     $this->assertNull($this->object->displayErrors());
     $arr = array("Servers/1/test" => array('e1'), "foobar" => array('e2', 'e3'));
     $sysArr = array("Servers/1/test" => "Servers/1/test2");
     $attrSystemPaths = $reflection->getProperty('_systemPaths');
     $attrSystemPaths->setAccessible(true);
     $attrSystemPaths->setValue($this->object, $sysArr);
     $attrIsValidated->setValue($this->object, $arr);
     $GLOBALS['strConfigForm_foobar'] = 'foobar123';
     $this->expectOutputString('<dl><dt>Servers_test2_name</dt>' . '<dd>e1</dd></dl><dl><dt>foobar123</dt><dd>' . 'e2</dd><dd>e3</dd></dl>');
     $this->object->displayErrors();
 }
开发者ID:roccivic,项目名称:phpmyadmin,代码行数:25,代码来源:PMA_FormDisplay_test.php

示例2:

        exit;
    } else {
        $error = $result;
    }
}
// display forms
$GLOBALS['js_include'][] = 'config.js';
require './libraries/header.inc.php';
require './libraries/user_preferences.inc.php';
if ($error) {
    $error->display();
}
if ($form_display->hasErrors()) {
    // form has errors
    ?>
    <div class="error config-form">
        <b><?php 
    echo __('Cannot save settings, submitted form contains errors');
    ?>
</b>
        <?php 
    $form_display->displayErrors();
    ?>
    </div>
    <?php 
}
$form_display->display(true, true);
/**
 * Displays the footer
 */
require './libraries/footer.inc.php';
开发者ID:BGCX262,项目名称:zuozhenshi-prego-svn-to-git,代码行数:31,代码来源:prefs_forms.php

示例3: PMA_Process_formset

/**
 * Processes forms registered in $form_display, handles error correction
 *
 * @param FormDisplay $form_display Form to display
 *
 * @return void
 */
function PMA_Process_formset(FormDisplay $form_display)
{
    if (isset($_GET['mode']) && $_GET['mode'] == 'revert') {
        // revert erroneous fields to their default values
        $form_display->fixErrors();
        PMA_generateHeader303();
    }
    if (!$form_display->process(false)) {
        // handle form view and failed POST
        echo $form_display->getDisplay(true, true);
        return;
    }
    // check for form errors
    if (!$form_display->hasErrors()) {
        PMA_generateHeader303();
        return;
    }
    // form has errors, show warning
    $separator = PMA_URL_getArgSeparator('html');
    $page = isset($_GET['page']) ? $_GET['page'] : null;
    $formset = isset($_GET['formset']) ? $_GET['formset'] : null;
    $formset = $formset ? "{$separator}formset={$formset}" : '';
    $formId = PMA_isValid($_GET['id'], 'numeric') ? $_GET['id'] : null;
    if ($formId === null && $page == 'servers') {
        // we've just added a new server, get its id
        $formId = $form_display->getConfigFile()->getServerCount();
    }
    $formId = $formId ? "{$separator}id={$formId}" : '';
    ?>
    <div class="error">
        <h4><?php 
    echo __('Warning');
    ?>
</h4>
        <?php 
    echo __('Submitted form contains errors');
    ?>
<br />
        <a href="<?php 
    echo PMA_URL_getCommon() . $separator;
    ?>
page=<?php 
    echo $page . $formset . $formId . $separator;
    ?>
mode=revert">
            <?php 
    echo __('Try to revert erroneous fields to their default values');
    ?>
        </a>
    </div>
    <?php 
    echo $form_display->displayErrors();
    ?>
    <a class="btn" href="index.php<?php 
    echo PMA_URL_getCommon();
    ?>
">
        <?php 
    echo __('Ignore errors');
    ?>
    </a>
    &nbsp;
    <a class="btn" href="<?php 
    echo PMA_URL_getCommon() . $separator;
    ?>
page=<?php 
    echo $page . $formset . $formId . $separator;
    ?>
mode=edit">
        <?php 
    echo __('Show form');
    ?>
    </a>
    <?php 
}
开发者ID:Kunigaikstis,项目名称:AzureTest-1,代码行数:82,代码来源:form_processing.lib.php

示例4: PMA_Process_formset

/**
 * Processes forms registered in $form_display, handles error correction
 *
 * @param FormDisplay $form_display Form to display
 *
 * @return void
 */
function PMA_Process_formset(FormDisplay $form_display)
{
    if (filter_input(INPUT_GET, 'mode') == 'revert') {
        // revert erroneous fields to their default values
        $form_display->fixErrors();
        PMA_generateHeader303();
    }
    if (!$form_display->process(false)) {
        // handle form view and failed POST
        $form_display->display(true, true);
        return;
    }
    // check for form errors
    if (!$form_display->hasErrors()) {
        PMA_generateHeader303();
        return;
    }
    // form has errors, show warning
    $separator = PMA_URL_getArgSeparator('html');
    $page = filter_input(INPUT_GET, 'page');
    $formset = filter_input(INPUT_GET, 'formset');
    $formset = $formset ? "{$separator}formset={$formset}" : '';
    $formId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
    if ($formId === null && $page == 'servers') {
        // we've just added a new server, get its id
        $formId = $form_display->getConfigFile()->getServerCount();
    }
    $formId = $formId ? "{$separator}id={$formId}" : '';
    ?>
    <div class="error">
        <h4><?php 
    echo __('Warning');
    ?>
</h4>
        <?php 
    echo __('Submitted form contains errors');
    ?>
<br />
        <a href="?page=<?php 
    echo $page . $formset . $formId . $separator;
    ?>
mode=revert">
            <?php 
    echo __('Try to revert erroneous fields to their default values');
    ?>
        </a>
    </div>
    <?php 
    $form_display->displayErrors();
    ?>
    <a class="btn" href="index.php"><?php 
    echo __('Ignore errors');
    ?>
</a>
    &nbsp;
    <a class="btn" href="?page=<?php 
    echo $page . $formset . $formId . $separator;
    ?>
mode=edit"><?php 
    echo __('Show form');
    ?>
</a>
    <?php 
}
开发者ID:minggLu,项目名称:openemr,代码行数:71,代码来源:form_processing.lib.php

示例5: process_formset

/**
 * Processes forms registered in $form_display, handles error correction
 *
 * @param FormDisplay $form_display
 *
 * @return void
 */
function process_formset(FormDisplay $form_display)
{
    if (isset($_GET['mode']) && $_GET['mode'] == 'revert') {
        // revert erroneous fields to their default values
        $form_display->fixErrors();
        // drop post data
        header('HTTP/1.1 303 See Other');
        header('Location: index.php');
        exit;
    }
    if (!$form_display->process(false)) {
        // handle form view and failed POST
        $form_display->display(true, true);
    } else {
        // check for form errors
        if ($form_display->hasErrors()) {
            // form has errors, show warning
            $separator = PMA_get_arg_separator('html');
            $page = isset($_GET['page']) ? $_GET['page'] : null;
            $formset = isset($_GET['formset']) ? $_GET['formset'] : null;
            $formset = $formset ? "{$separator}formset={$formset}" : '';
            $id = PMA_isValid($_GET['id'], 'numeric') ? $_GET['id'] : null;
            if ($id === null && $page == 'servers') {
                // we've just added a new server, get it's id
                $id = ConfigFile::getInstance()->getServerCount();
            }
            $id = $id ? "{$separator}id={$id}" : '';
            ?>
            <div class="error">
                <h4><?php 
            echo __('Warning');
            ?>
</h4>
                <?php 
            echo __('Submitted form contains errors');
            ?>
<br />
                <a href="?page=<?php 
            echo $page . $formset . $id . $separator . PMA_generate_common_url() . $separator;
            ?>
mode=revert"><?php 
            echo __('Try to revert erroneous fields to their default values');
            ?>
</a>
            </div>
            <?php 
            $form_display->displayErrors();
            ?>
            <a class="btn" href="index.php?<?php 
            echo PMA_generate_common_url();
            ?>
"><?php 
            echo __('Ignore errors');
            ?>
</a>
            &nbsp;
            <a class="btn" href="?page=<?php 
            echo $page . $formset . $id . $separator . PMA_generate_common_url() . $separator;
            ?>
mode=edit"><?php 
            echo __('Show form');
            ?>
</a>
            <?php 
        } else {
            // drop post data
            header('HTTP/1.1 303 See Other');
            header('Location: index.php');
            exit;
        }
    }
}
开发者ID:AmberWish,项目名称:laba_web,代码行数:79,代码来源:form_processing.lib.php


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