|
|
|
|
|
|
(Since version FH3-v1.1)
SetErrorMessage |
SetErrorMessage (
string |
$field |
string |
$message |
boolean |
$useStyle = true |
) |
Arguments:
Name |
Description |
$field |
The field where you want to set a special error message for. |
$message |
The error message you want to set for this field |
$useStyle |
Should the error style set around the error message? |
Description:
With this function you can set a custom error message for a specific field
Example
<?php
// include the class
include('FH3/class.FormHandler.php');
// create a new formhandler object
$form = new FormHandler();
// a textfield + custom error message!!!
$form -> textField("First Name", "fname", FH_STRING);
$form -> setErrorMessage( "fname", "You have to enter a first name!");
// button to submit the form
$form -> submitButton();
// what to do when the form is correct...
$form -> onCorrect('doRun');
// display the form
$form -> flush();
// do something...
function doRun( $data )
{
echo "Hello ". $data["fname"];
}
?>
|
Latest change: 05 March 10 / 08:45
Comments
|
|
|
|