Hi - great tool and I am starting to get my head around it, but I have run into an issue that seems to invalidate my html when using setErrorMessage
In your example
$form -> setErrorMessage( "fname", "You have to enter a first name!");
my output code would look like this
<span id="error_Array" class="error" >You have to enter a first name!</span>
The issue is with the span's id ="error_Array". If I use setErrorMessage elsewhere the new error message is also returned with an id="error_Array", which is invalid markup, and makes it hard to css style individual error messages.
Here you go - this is a shorter than my full form, but still gives me the the issue with both <span> id's = "error_Array".
<?php
// include the class
include('../php/formhandler/class.FormHandler.php');
// make a new $form object
$form = new FormHandler();
$star = ' <em class="importStar">*</em>';
$form->enableAjaxValidator( true );
// noTables
$form -> useTable(false);
// add a line that every field with a red * is required
$form -> addLine("<p>".$star ." = Required fields</p>");
$form->textField("What".$star, "what", FH_STRING,50,100);
$form -> setErrorMessage( "what", "Please enter a valid event title!");
$form->textField("Where".$star, "where", FH_STRING,50,100);
$form -> setErrorMessage( "where", "Please enter a valid event address!");
// submitbutton beneath it
$form->submitButton("Submit");
// set the 'commit after form' function
$form->onCorrect("doRun");
// send the form to the screen
$form->flush();
// function to show a message
function doRun($data)
{
return "Thankyou ". $data["name"];
}