Announcement

Collapse
No announcement yet.

How can I add extra fields into the 'Contact Us' email form (v8 and above)?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How can I add extra fields into the 'Contact Us' email form (v8 and above)?

    To create new fields in the 'Contact Us' form you need to:

    1. Open the 'Contact Us' page in the 'Design' tab using the 'Select Page Type' drop down. Then click on the fields in the form in the preview to select the correct layout.

    2. Add a new row where you want the field to display using the following code:

    <tr>
    <td>&nbsp;</td>
    <td>
    My New Field Name:
    </td>
    <td>
    <input name="MyNewField" size="50" maxsize="125" value="" type="text"/>
    </td>
    </tr>

    3. If the field is to be required then change the field prompt to look like:

    <span class="actrequired">My New Field Name:*</span>

    4. Click 'Apply'

    5. Open 'Windows Explorer' and browse to C:\Program Files\Actinic v8\Sites\ *

    6. Open 'MailForm.pl' in a text editor such as notepad

    7. Search for: 'sub SendMailToMerchant'

    8. You should see :

    # Receive parameters from input hash
    #
    my ($sEmailRecpt, $sSubject, $sTextMailBody, $sName, $sMessage, $sHTML);

    add in $sMyNewField, so it looks something like:

    # Receive parameters from input hash
    #
    my ($sEmailRecpt, $sSubject, $sTextMailBody, $sName, $sMessage, $sMyNewField, $sHTML);

    9. You need to create a variable for each extra field that you want to display so after :

    $sSubject = $::g_InputHash{'Subject'};

    add a similar line for each field, for example:

    $sMyNewField = $::g_InputHash{'MyNewField'};

    10. Then search for:

    # Construct the mail text and send it to the merchant

    11. You need to add a line for each field after:

    $sTextMailBody .= ACTINIC::GetPhrase(-1, 2373) . "\r\n" . $sMessage . "\r\n\r\n";

    for example:

    $sTextMailBody .= "MyNewFieldName:" . $sMyNewField . "\r\n";

    12. Then directly after these new fields you should see:

    my @Response = ACTINIC::SendMail($::g_sSmtpServer, $$::g_pSetupBlob{EMAIL}, $sSubject, $sTextMailBody, $sEmailRecpt);

    13. You need to add in your new variables so they are sent with the email, for example:

    my @Response = ACTINIC::SendMail($::g_sSmtpServer, $$::g_pSetupBlob{EMAIL}, $sSubject, $sTextMailBody, $sEmailRecpt, $sMyNewField);

    14. If you want to make your new field to be required then you need to search for:

    elsif ($sEmailRecpt !~ /.+\@.+\..+/)
    {
    $sError .= ACTINIC::GetPhrase(-1, 2378) . "\r\n";
    }

    15. Copy the following code and paste it directly after the above and change the relevant parts, ie:

    if ($sMyNewField eq "")
    {
    $sError .= "My New Field is required";
    }

    16. Save and close the file and update your site.

    * NOTE: All versions after v11.03 will have a file path of 'C:\Program Files\SellerDeck xxxx'.
    Additionally there is an alternative method of doing this here: http://community.sellerdeck.com/show...16&postcount=7
Working...
X