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


PHP Form::renderAjaxErrorResponse方法代码示例

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


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

示例1: header

<?php

use PFBC\Form;
use PFBC\Element;
session_start();
error_reporting(E_ALL);
include "../PFBC/Form.php";
if (isset($_POST["form"])) {
    if (Form::isValid($_POST["form"])) {
        header("Content-type: application/json");
        echo file_get_contents("http://maps.google.com/maps/api/geocode/json?address=" . urlencode($_POST["Address"]) . "&sensor=false");
    } else {
        Form::renderAjaxErrorResponse($_POST["form"]);
    }
    exit;
}
include "../header.php";
$version = file_get_contents("../version");
?>

<div class="page-header">
	<h1>Ajax</h1>
</div>

<p>PFBC provides several properties and methods for facilitating ajax submissions.  To get started, you'll first need to set the ajax property in
the form's configure method.  The ajaxCallback property can also be included in the configure method if you'd like a javascript function to called
after the form's data has been submitted.  In the example below a callback function has been set to extract the latitude/longitude information from a
json response.</p>

<p>The validation process for an ajax submission also differs slightly from that of a standard submission.  If the form's isValid method 
returns false, you will need to invoke the renderAjaxErrorResponse method, which returns a json response containing the appropriate error messages.  
开发者ID:gaabora,项目名称:php-form-builder-class,代码行数:31,代码来源:ajax.php


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