本文整理匯總了PHP中CommentForm::is_valid方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommentForm::is_valid方法的具體用法?PHP CommentForm::is_valid怎麽用?PHP CommentForm::is_valid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommentForm
的用法示例。
在下文中一共展示了CommentForm::is_valid方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: elseif
echo $form->buttons();
?>
<?php
echo $form->close();
?>
<h4>Raw POST data:</h4>
<?php
var_dump($_POST);
?>
<hr />
<?php
// Check form validity
if ($form->is_bound() && $form->is_valid()) {
?>
<h4>Processed and cleaned form data:</h4>
<?php
$form->report();
?>
<?php
} elseif ($form->has_errors()) {
?>
<h4>Errors:</h4>
<?php
var_dump($form->get_errors());
?>
<?php
} else {
?>
示例2: report
$this->message = new Phorm_Field_Textarea('Message', 5, 40, array('required'));
$this->notify = new Phorm_Field_Checkbox('Reply notification');
// Add some help text
$this->notify->help_text('Email me when my comment receives a response.');
$this->email->help_text('We will never give out your email address.');
}
public function report()
{
var_dump($this->cleaned_data());
}
}
// Set up the form
$post_id = 42;
$form = new CommentForm('post', false, array('post_id' => $post_id, 'notify' => true));
// Check form validity
$valid = $form->is_valid();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Comment Form example for Phorm</title>
<link rel="stylesheet" href="assets/style.css" type="text/css" />
</head>
<body>
<h1>Add a comment</h1>
<?php
echo $form->open();
?>
<?php
if ($form->has_errors()) {