Developer Support »

Requiring at least one of two fields but not necessarily both  (See more user questions)

Hi .

I was just thinking..."It's been a while since you bothered me"!

Good question.

There isn't a facility for that in the script but you could use a snippet of
code to check for it (watch for wordwrap):

if((isset($_POST['field_A']) && empty($_POST['field_A'])) &&
(isset($_POST['field_B']) && empty($_POST['field_B']))){$errors[] = "Please
upload your resume or application form";}

Put the code after:

$errors = array();

Change the field names and error message to suit.

Using the above code, you would not put field_A or field_B in the required
fields array, for the reason you have figured (you can't *require* both).

Any questions, just let me know.

Best wishes.

Charles Sweeney
https://formtoemail.com
The world's easiest feedback script!

----- Original Message -----
Sent: Tuesday, February 08, 2011 5:28 PM
Subject: Re: New Feature?

Hi Charles,

It's been awhile since I've bothered you! I have another special
circumstance I'm wondering if your script can handle (I know it probably
can, I just don't know how to make it happen)�

I'm using your script to allow people to apply for a job, so I need the
script to have one of two fields required (one or the other is needed):
users need to upload their resume and/or an application (they can do both
but not none). Is there a way to require field A or field B?

Thanks for any help,