[phplib] optional form fields From: Philip Strnad (philip <email protected>)
Date: 11/21/00

Hello,

I have a quick question for the OOH form gurus on the list. What is the
best way to implement optional fields in a form? What I want to do is
this: a user should be able to leave certain optional fields blank, but
if they enter something then I want to make sure they enter something
valid. I've been using OOH forms for a long time and for some reason
I've never had to do this before. Now I have to and I don't see
anything in the docs that describes this. Perhaps one could do
something like this:

$f->add_element(array("type" => "text",
                      .....
                      "required" => 0));

which would indicate that the field isn't required. The validation of
the form input would ignore this field if the user didn't enter
anything, but if he/she did, then it would validate the input according
to valid_regex.

I know there's been discussions about new forms classes written by Ulf
Wendel, but I'm not sure if the new code handles this. Also, right now
I'm not in a position to upgrade.

Thanks for any suggestions

Philip

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