HTML_QF suggestion, function isPosted()
| From: | Ian P. Christian | Date: | Fri, 10 Jun 2005 08:48:36 +0000 |
| Subject: | HTML_QF suggestion, function isPosted() | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-19595@lists.php.net to get a copy of this message | ||
I would suggest a function to check if a form has been posted.
function isPosted() {
if (count($this->_rules) == 0 && count($this->_formRules) == 0 &&
(count($this->_submitValues) > 0 || count($this->_submitFiles) >
0)) {
return true;
} elseif (count($this->_submitValues) == 0 &&
count($this->_submitFiles) == 0) {
return false;
}
}
validate() already has this code, but I think it should be abstracted out into
a public function. I have a Form::setArticle() function that is used to set
defaults to edit an object, this function reads from a database and sets teh
defaults, but it should only do this the first time the form is loaded for
performance reasons.
Feedback?
--
Ian P. Christian ~ http://pookey.co.uk
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]