Author Topic: problems with required field and thank you page  (Read 1053 times)

0 Members and 1 Guest are viewing this topic.

Offline oscar

  • Newbie
  • *
  • Posts: 1
problems with required field and thank you page
« on: November 06, 2013, 09:49:07 AM »
using dreamweaver 8

The form works on the website but I don't want it being sent if the names are missing.


where do i put the coding for the required fields?
    <th scope="row" align="right" class="style8">*<span class="required">Your first name:&nbsp; </span></th>
  <th align="left" valign="center"> <input type="text" name="required-firstname" size="26" maxlength="60" /> </th></tr>
  <tr>
    <th scope="row" align="right" class="style8">*Your surname:&nbsp;</th>
  <th align="left" valign="center" width="497"><input type="text" name="required-surname" size="26" maxlength="60" />  </th></tr>
  <tr>
    <th scope="row" align="right"class="style8">*Your home address:&nbsp;</th>
  <th align="left" valign="center" width="497"><input type="text" name="required-address" size="26" maxlength="60" />  </th></tr>

THANK YOU PAGE
<form method="post" action="cgi-bin/form2email.pl" name="FeedBack_Form"><input type="hidden" name="recipient" value="email address removed /> <input type="hidden" name="redirect" value="http://www.norfolktutors.co.uk/thankyou.html" />

Offline Jason

  • Administrator
  • Hero Member
  • *****
  • Posts: 1018
    • slipdex
Re: problems with required field and thank you page
« Reply #1 on: November 07, 2013, 10:57:10 AM »
Oscar,

The code goes in the script itself. Here is the block:

Code: [Select]
# Advanced Settings required fields
my @required_fields          = ();
my @required_fields_numbers  = ();
my @required_fields_email    = ();
my $error_fields_require     = "Field is blank, it is required";
my $error_fields_numbers     = "Only numbers";
my $error_fields_email       = "email address is not valid";
my $error_title              = "<b>Sorry, we need you to check the following</b>";
my $fontColor                = "black";
my $fontSize                 = 3;
my $fontFace                 = "Verdana";
my $return_message           = "Please click 'back' on your browser and try again";

You will want to separate the fields you reqire by using single quotes and a comma, like this:

Code: [Select]
my @required_fields          = ('field1','field2','field3');
Same thing if you want to require number only fields and for the e-mail. As a note the e-mail required field only checks for correctly formatted e-mail addresses, not verification that it is an actual e-mail.

Jason
Founder of www.slipdex.com