Announcement

Collapse
No announcement yet.

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

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

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

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

    1. Edit the 'Act_ContactUs.html' template (Advanced | Template Manager | Other Pages tab | Contact Us button' (click 'Change View' if you do not see the tabs))

    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="actrequiredcolor">My New Field Name:*</span>

    4. Save and close the the file

    5. Open 'Windows Explorer' and browse to C:\Program Files\Actinic v7\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. A little further down you should see the above line again - under:

    # Send the same message to the sender
    # Withe a "thank you" prefix

    15. Make the same change

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

    if ($sEmailRecpt eq "")
    {
    $sError .= ACTINIC::GetRequiredMessage(-1, 2371);
    }

    17. Copy this code and paste it directly after it and change the relevant parts, ie:

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

    18. Save and close the file and update your site.
Working...
X