Re: [phplib] OOHForms process From: Eric Ries (eric.ries <email protected>)
Date: 07/26/00

I have made some modifications to OOHFORMS that accomplish a very similar
thing. I had show_element() automatically call validate() for each element,
and print an error message above the HTML for the form element itself. It
would be trivial to modify this to simply freeze the element instead. If
you are interested, I'd be happy to send you a patch, or you can download
it from http://enzyme.sourceforge.net (it's part of OOHFORMS-extra)

Eric

At 05:32 AM 7/26/00, Hellekin O. Wolf wrote:
>Hello ppl !
>
>I'm looking for working examples of forms using OOHForms that do the
>following :
>
>1. Display a form
>2. Validate data and return the form with correct fields frozen,
>incorrect fields with an error string above
>3. Process data if all is ok, then return a result page
>
>The documentation is quite obscure and I don't know how to use the
>self_* methods.
>
>Right now I'm passing the following code :
>
>$f->new Form;
>
>$field["field_name"] = array(
> "type" => "text",
> "name" => "field_name"
> [...]
>);
>$f->add_element($field["field_name"]);
>
>[...]
>
>$f->show_element("field_name");
>
>[...]
>
>if ($submit) {
> // Validate elements
> $f->start();
> while (list($k,$v) = each($HTTP_POST_VARS)) {
> if ($err = $f->validate(FALSE,array($k,$v))) {
> // Display error and the field again
> echo "<p><font color=\"#ff3300\">Error :
>$err</font></p>\n";
> $f->add_element($field[$k]);
> $f->show_element($k);
> } else {
> // display the frozen element
> $f->add_element($field[$k]);
> $f->freeze(array($k));
> $f->show_element($k,$v);
> }
> }
> $f->finish();
>} else {
> // Display empty Form
>[...]
>}
>
>The problem is that the frozen items don't get the field value and
>display an empty table.
>
>Thanks
>
>hellekin
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: phplib-unsubscribe <email protected>
>For additional commands, e-mail: phplib-help <email protected>

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>