本文整理汇总了PHP中TextField::setMaxlength方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::setMaxlength方法的具体用法?PHP TextField::setMaxlength怎么用?PHP TextField::setMaxlength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextField
的用法示例。
在下文中一共展示了TextField::setMaxlength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CaptchaField
/**
* FormHandler::captchaField()
*
* Creates a captchafield on the form using Securimage - A PHP class for creating and managing form CAPTCHA images
*
* @param string $title: The title of the field
* @param string $name: The name of the field
* @param int $size: The size of the field
* @param int $maxlength: The allowed max input of the field
* @param string $extra: CSS, Javascript or other which are inserted into the HTML tag
* @return void
* @access public
* @author Johan Wiegel
* @since 27-11-2007
*/
function CaptchaField($title, $name, $size = null, $maxlength = null, $extra = null)
{
static $bCaptcha = true;
if ($bCaptcha) {
$bCaptcha = false;
require_once FH_INCLUDE_DIR . 'fields/class.TextField.php';
// create the field
$fld = new TextField($this, $name);
if ($this->isPosted()) {
$fld->setValidator('FH_CAPTCHA');
}
if (!empty($size)) {
$fld->setSize($size);
}
if (!empty($maxlength)) {
$fld->setMaxlength($maxlength);
}
if (!empty($extra)) {
$fld->setExtra($extra);
}
$this->ImageButton(FH_FHTML_DIR . 'securimage/securimage_show.php?sid=' . md5(uniqid(time())), null, 'onclick="return false;" style="cursor:default;"');
// register the field
$this->_registerField($name, $fld, $title);
// empty the field if the value was not correct.
if ($this->isPosted() && !$this->isCorrect()) {
$this->setValue($name, "", true);
}
} else {
trigger_error("Only one captchafield in a form", E_USER_WARNING);
}
}