Login Retreive lost passwordRegister
Search

Forum Index / Feedback / Control over output of error message

[ This topic is solved ]

  Rich Scannell 25 May 06 / 00:55  
On my site, data entry forms kind of look like dialogs. Because of the presentation, I prefer to surface data entry errors outside the "dialog" area. For an example of said behavior, please goto
my contact form and click "Send" with out entering any data.

Is it possible to do this with FormHandler? I'm new to this excellent tool, and it looks like the error is always output in proximity to the data entry field.

- Rich

  Teye Heimans (Founder) 26 May 06 / 15:22  
You can use 2 options, listed below

1. Use a different mask. By default, FormHandler uses a single row mask, repeated for every field. You can easaly change this into a complete "table" (template-like). If you use a complete table as mask, you can put the %error% placeholder outside of your table. Then, at last, you can change the error messages with setErrorMessage (e.g. that messages like "this field is incorrect" can be changed into "the name is incorrect").

http://www.formhandler.net/manual/50/SetMask.html

2. Use the catch error function in formhandler. Problem is that some errors (database check errors, e.g. unique field checks) are not catched with this function (known bug). Also known bug is that the function getTitle not works when flush() is called.

http://www.formhandler.net/manual/56/CatchErrors.html

  gene 01 June 06 / 03:51  
Changed at 01 June 06 / 03:52
before using FH, I used to do it the same way as http://www.relaweb.com/contact.aspx

but only because I couldn't do it any other way (well, maybe I could have but I am just a LAZY SOD...!).

Personally, it seems to me to make more sense to place the error message in close proximity to the field containing the error. I think this is especially true for longer forms with many fields.

IMHO. :-)

Here is what I have done:

<?php
$form
->setErrorMessage"email""<br /><font color=\"red\"><strong>You must enter a valid Email address!</strong></font>"); 
?>


by adding the <br />, the error msg appears immediately under the field with the error.



.

  Teye Heimans (Founder) 01 June 06 / 10:21  
If you just want to place the error message under the field, you could just use a css class. By default, all error messages get a css class named "error" (See 'FH_ERROR_MASK' in the config file). If you use a css class like this below, the error messages should appear below the field.


.error {
    font-family: arial;
    font-size: 9pt;
    color: red;
    padding: 1px;
}

  Top


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