Login Retreive lost passwordRegister
Search

Manual  /  Functions  /  Look & Feel  /  SetMaxLength

(Since version FH3-v1.1)

SetMaxLength
SetMaxLength (
string $field
integer $maxlength
boolean $displayMessage = true 
)

Arguments:

Name Description
$field The name of the textarea which you want to limit.
$maxlength The maximum allowed input length of the textarea
$displayMessage Should a message being displayed to the user how many characters there are left to use in the textarea?

Description:

With this function you can limit the input of a textarea

Example

<?php 

// include the class 
include_once('FH3/class.FormHandler.php'); 

// create a new formhandler object 
$form = new FormHandler(); 

// Limited textarea 
$form -> textArea("Text""myTextArea"); 
$form -> setMaxLength("myTextArea"20); 

// button to submit the form 
$form -> submitButton(); 

// set the handler 
$form -> onCorrect("doRun"); 

// display the form 
$form -> flush(); 

// the data handler 
function doRun$data 

    echo 
nl2br$data["myTextArea"] ); 

?>

Preview image

preview image

See also: TextArea

Latest change: 05 March 10 / 08:42

Comments

powered by PHP-GLOBE   © 2004 - 2024 FormHandler. All rights reserved.   -   Open source license