本文整理匯總了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.