|
Posted by Manuel Lemos on 03/04/07 07:36
Hello,
on 03/02/2007 11:09 PM Phil Latio said the following:
> At the moment the forms are simply static html templates and the form input
> is checked using a validation class. Basically each form field is checked,
> every error is stored to an array and at the end of checking of the complete
> form, the array is output neatly at the top of the form.
>
> However this is just not sexy enough for me, what I would like to happen is
> for the input boxes with errors to be highlighted with a red border (or
> something along those lines). I would also like to have the error messages
> under the box which the error occured, not altogether at the top of the
> page.
>
> So I am currently wondering how to achieve this and what choices are open to
> me on methods available? I've had a google around the web and found some
> form validation classes but they basically do what I already achieved. I've
> thought of creating the forms dynamically but that in itself doesn't address
> how to achieve my goal.
>
> I am sure many people have already successfully done this, if you have the
> please could give me an outline (the theory) of how you did it. I don't want
> or need code, I am simply stuck at the moment on how to approach this.
You may want to take a look at this forms generation and validation class.
Among other things, it can highlight invalid inputs with an alternative
CSS class or individual style attributes. It can generate Javascript to
highlight invalid fields on the browser side or server side.
You can set a global invalid class or style or different invali classes
or styles for different inputs.
http://www.phpclasses.org/formsgeneration
Take a look here at the test_form.php script in action:
http://www.meta-language.net/forms-examples.html?example=test_form
Here you can see a tutorial video with a section that explains that example:
http://www.phpclasses.org/browse/video/1/package/1/section/example-form.html
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
[Back to original message]
|