|
Posted by Toby A Inkster on 05/22/07 06:53
Jon Slaughter wrote:
> What I mean is, say I want to insert a div for absolute positioning
> of some element inside a form... can I do that with your class easily?
Not yet, no. It wraps a good few elements round each form control by
itself though, most of which have classes and IDs, so can be styled as
required. The comment forms on my website are one example.
> Your set_validity_check seems to be very similar to what I was doing
> except I didnt' call it validation and mine is more primitive. Mine simply
> executes code and that code can be anything. It is attached to a form(or
> could be attached to the page) and is executed when the form is processed.
> In this way one can do anything they want when a form is submitted rather
> than just validate data... although I suspect that your function is not
> that restrictive either?
Mine is entirely intended for data validation. You can't reasonably do
much more with it because it only operates on a single field -- not the
whole form.
When the form has been submitted you call:
$ok = $form->accept_submission() && $form->validate();
then the DBF_Form object will read submitted data and validate each field
in turn. Then you can call:
$vals = $form->get_values();
which returns an array of validated values, and you can do with that what
you want (e-mail it, store it in a database, etc).
--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
Navigation:
[Reply to this message]
|