Categories

Featured templates

JS Animated. How to add contact form field

Norman Fisher July 15, 2013
Rating: 5.0/5. From 2 votes.
Please wait...

This tutorial is going to show you how to add a new contact form field to your JS animated template.

JS Animated. How to add contact form field

For instance, the contact form on your JS animated template looks like this:

And you are going to add a new field to it named “Fax” coming right after the “Telephone” field.

  1. First off, open the .html file that contains the form in Dreamweaver.
  2. Click on Split.
  3. To add a new field, you need to copy  the code for one of the existing fields. Click on the “Telephone” field to select its code.
  4. Copy the code e.g
  5. <label class="phone">
    <input type="tel" value="Telephone:">
    <br class="clear">
    <span class="error error-empty">*This is not a valid phone number.</span><span class="empty error-empty">*This field is required.</span> </label>
  6. And paste it right where the selected part ends (since the new “Fax” field comes right after the “Telephone” field)
  7. You should now see 2 identical “Telephone” fields, so all you have to do is to change the names to fax in the second one:
  8. <label class="fax">
    <input type="fax" value="Fax:">
    <br class="clear">
    <span class="error error-empty">*This is not a valid Fax number.</span><span class="empty error-empty">*This field is required.</span> </label>
  9. We do  not want fax to be a required field , so we are going to change it to just
  10. <label class="fax">
    <input type="fax" value="Fax:">
    <br class="clear">
    </label>
  11. Save the changes to the .html file.
  12. Go to the “js” folder and open the forms.js file in Dreamweaver (or just click on it in the Source Code panel of Dreamweaver).
  13. Make sure you have such lines there (Otherwise, you’ll need to add them by duplicating the identical nines for the fields that already exist and changing the names to “fax” in them):
  14. (about line 25)

        
      ".fax":{rx:/^\+?(\d[\d\-\+\(\) ]{5,}\d$)/,target:'input'},
    

    (about line 108)

       
     
      fax:_.getValFromLabel($('.fax',_.form)),
      
  15. Make sure to change # to your email address to activate the form.
  16. Open the mailhandler.php file in the “bat” folder and make sure you have such lines there (otherwise, you’ll need to add them by duplicating the identical nines for the fields that already exist and changing the names to “fax” in them):
  17.    
    
    if($_POST['fax']!='nope'){ 
    $messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n";
    $messageBody .= '<br>' . "\n";
    }
    (Where you can change the text Fax Number if you want some different text in the message that comes)
  18. Upload the content of the ‘site’ folder to your FTP.
  19. Try to send an email to check if the second field works.

Feel free to check the detailed video tutorial below:

JS Animated. How to add contact form field
This entry was posted in JS Animated tutorials and tagged add, animated, contact, field, form, js. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket