Sample> FormHook


// include TPLN

$TPLN = new TPLN();

$TPLN->formSetName('form'); // specify a form name

// change error display mode
if(!isset($_GET['display_mode']) || ($_GET['display_mode'] != 'T' && $_GET['display_mode'] != 'I'))


// rules
$TPLN->alphaNumeric('Firstname''_'); // only characters and _

"Number of error in the form: ".$TPLN->formGetTotalError();

// your treatment here...


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Form hook</title>
    <style type="text/css">
    .form_error {color:red; font-weight: bold;}
    #formtab {background-color:#CCCCCC;}
    #formtab td {background-color:#fff;}
    #formtab th {background-color:#E5E5E5;font-weight:bold;text-align:left;}
    #formtab span {font-weight: bold;color: #FF0000;margin:0;padding:0;}
    <link href="../style.css" rel="stylesheet" type="text/css" />


<h1>This example shows a method to customize error message</h1>

<!-- hide form error -->
<div class="form_error">
        <strong>• {msg}</strong><br />
<!-- hide form error -->

<form id="form" name="form" method="post" action="?display_mode={$_GET['display_mode']}">
<table cellpadding="3" cellspacing="1" id="formtab">
    <th width="100" scope="row">Display error mode:  </th>
        <input type="button" value="Top" onclick="alert('Display error mode changed to \'T\' please submit the form after the redirection');document.location.href='?display_mode=T';" />
        <input type="button" value="Inline" onclick="alert('Display error mode changed to \'I\' please submit the form after the redirection');document.location.href='?display_mode=I';" />

    <th width="105" scope="row">Fistname</th>
    <td width="345">
          <input name="Firstname" type="text" id="Firstname" size="65" />
        <span id="error_Firstname"></span>

    <th scope="row">FamilyName</th>
        <input name="FamilyName" type="text" id="FamilyName" size="65" />
        <span id="error_FamilyName"></span>

    <th scope="row">Email</th>
        <input name="Email" type="text" id="Email" size="65" />
          <span id="error_Email"></span>

    <td colspan="2" align="center" scope="row"><input type="submit" name="Submit" value="Submit" /></td>

<div id="form_valid">
Your form was submitted without errors !
And replaced by blocform_valid !

<br />
<br />
{_Logo}<font size="1"> in {_Chrono} s<br>
Queries executed: {_QueryCount}</font>