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


PHP FormBuilder::validateField方法代码示例

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


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

示例1: array

// configure generate schedule form
$generateFormFields = array();
$generateFormFields["firstmatchday"] = array("type" => "timestamp", "value" => "", "required" => "true");
$generateFormFields["rounds"] = array("type" => "number", "value" => "1", "required" => "true");
$generateFormFields["timebreak"] = array("type" => "number", "value" => 5, "required" => "true");
$showEditForm = FALSE;
// Actions
if ($action == "create") {
    if ($admin["r_demo"]) {
        throw new Exception($i18n->getMessage("validationerror_no_changes_as_demo"));
    }
    try {
        // validate fields
        foreach ($formFields as $fieldId => $fieldInfo) {
            $fieldValue = isset($_POST[$fieldId]) ? $_POST[$fieldId] : "";
            FormBuilder::validateField($i18n, $fieldId, $fieldInfo, $fieldValue, "managecuprounds_group_label_");
        }
        $teamIds = $_POST["teams"];
        $inserTable = $website->getConfig("db_prefix") . "_cup_round_group";
        // save
        foreach ($teamIds as $teamId) {
            $columns = array();
            $columns["cup_round_id"] = $roundid;
            $columns["team_id"] = $teamId;
            $columns["name"] = $_POST["name"];
            $db->queryInsert($columns, $inserTable);
        }
    } catch (Exception $e) {
        echo createErrorMessage($i18n->getMessage("subpage_error_alertbox_title"), $e->getMessage());
    }
    echo createSuccessMessage($i18n->getMessage("alert_save_success"), "");
开发者ID:astroChasqui,项目名称:open-websoccer,代码行数:31,代码来源:managecuprounds-groups.php

示例2: array

 }
 // validate
 $dbcolumns = array();
 foreach ($formFields as $fieldId => $fieldInfo) {
     if ($fieldInfo["readonly"]) {
         continue;
     }
     if ($fieldInfo["type"] == "timestamp") {
         $dateObj = DateTime::createFromFormat($website->getConfig("date_format") . ", H:i", $_POST[$fieldId . "_date"] . ", " . $_POST[$fieldId . "_time"]);
         $fieldValue = $dateObj ? $dateObj->getTimestamp() : 0;
     } elseif ($fieldInfo["type"] == "boolean") {
         $fieldValue = isset($_POST[$fieldId]) ? "1" : "0";
     } else {
         $fieldValue = isset($_POST[$fieldId]) ? $_POST[$fieldId] : "";
     }
     FormBuilder::validateField($i18n, $fieldId, $fieldInfo, $fieldValue, $labelPrefix);
     // apply converter
     if (strlen($fieldInfo["converter"])) {
         $converter = new $fieldInfo["converter"]($i18n, $website);
         $fieldValue = $converter->toDbValue($fieldValue);
     }
     // convert date
     if (strlen($fieldValue) && $fieldInfo["type"] == "date") {
         $dateObj = DateTime::createFromFormat($website->getConfig("date_format"), $fieldValue);
         $fieldValue = $dateObj->format("Y-m-d");
     } else {
         if ($fieldInfo["type"] == "timestamp" && $fieldInfo["readonly"] && $show == "add") {
             $fieldValue = $website->getNowAsTimestamp();
         } else {
             if ($fieldInfo["type"] == "file") {
                 if (isset($_FILES[$fieldId]) && isset($_FILES[$fieldId]["tmp_name"]) && strlen($_FILES[$fieldId]["tmp_name"])) {
开发者ID:astroChasqui,项目名称:open-websoccer,代码行数:31,代码来源:manage.php


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