No announcement yet.

Can I add a new custom field into the contact us form? V8 Onwards

  • Filter
  • Time
  • Show
Clear All
new posts

    Can I add a new custom field into the contact us form? V8 Onwards

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

    1. Go to the 'Design' tab in the 'Select Page Type' drop-down list select 'Contact Us'.

    2. Click on one of the prompts on the page (e.g. 'Message') to select the 'Contact Us Bulk Area' layout.

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

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

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

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

    5. Save and close the file.

    You now need to edit the Perl script that controls the message sending.

    6. Open 'Windows Explorer' and browse to C:\Program Files\Actinic v...\Sites\<site name>

    7. Open '' in a text editor such as Notepad.

    8. Search for: 'sub SendMailToMerchant'

    9. You should see the following line:

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

    10. Add in $sMyNewField, so it looks something like:

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

    11. 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'};

    12. Then search for: '# Construct the mail text and send it to the merchant'

    13. 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";

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

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

    15. 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);

    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, i.e.:

    if ($sMyNewField eq "")
    $sError .= "<b>'My New Field'</b> is required<br>";

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

    SellerDeck is not able to provide any detailed support for script changes made. If you find that there is a problem, an original copy of the script can be found within the 'Original' folder in your installation. Copy this into your site folder.