Developer Support »

Custom error message for a required field  (See more user questions)

Hi , good to hear from you.

Locate this line in the script:

foreach($required_fields as $value){if((!isset($_REQUEST[$value]) ||
empty($_REQUEST[$value])) && (!isset($_FILES[$value]['name']) ||
empty($_FILES[$value]['name']))){$errors[] = "Please complete the $value
field";}}

...change it to this:

foreach($required_fields as $value){if((!isset($_REQUEST[$value]) ||
empty($_REQUEST[$value])) && (!isset($_FILES[$value]['name']) ||
empty($_FILES[$value]['name']))){if($value == "request-for"){$errors[] =
"Please select a house";}else{$errors[] = "Please complete the $value
field";}}}

The above code checks for the field "request-for" to make the special error
message.

Any questions, just let me know.

Best wishes.

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

----- Original Message -----
Sent: Wednesday, August 18, 2010 3:59 PM
Subject: FormToEmail script

> Comments: Hi, I wonder if we can insert a bit of script that warns
> applicant when he/she has omitted to click a radio button (in this case to
> select a house from a number of others, see
> http://www.example.com/aa2.html ) I have now included the field
> name in the required field array but I would like it if I could get a
> different message (like " please select a house" for this bit. Thank you
> very much,