I bought a template online and i'm trying to develop a website and I'm stuck on the contact form. I can't seem to get it to submit. When I click submit it just remains static, but i'd like to get it to run the action- that is go to the contactTq.php page. Below is all the code i think you need. but if you want the entire .js file it's here: http://pastebin.com/1B1j9pkB

        type: "POST",
        success: function(){

Here is the form im using:

<form id="contact-form" action="contactTq.php" method="post">
<div class="success"> Contact form submitted! <strong>We will be in touch soon.</strong></div>
    <label class="name">
        <input type="text" value="Enter Your Name:">
        <span class="error">*This is not a valid name.</span>
        <span class="empty">*This field is required.</span>
        <span class="clear"></span>
    <label class="email">
        <input type="text" value="Enter Your E-mail:">
        <span class="error">*This is not a valid email address.</span>
        <span class="empty">*This field is required.</span>
        <span class="clear"></span>
    <label class="phone">
        <input type="text" value="Enter Your Phone (optional):">
        <span class="error">*This is not a valid phone number.</span>
        <span class="clear"></span>
    <label class="message">
        <textarea>Enter Your Message:</textarea>
        <span class="error">*The message is too short.</span>
        <span class="empty">*This field is required.</span>
        <span class="clear"></span>
    <div class="buttons"><strong><a class="button" data-type="reset">Reset<span></span></a></strong><strong><a class="button" data-type="submit">Submit<span></span></a></strong></div>

If you need any other info, please let me know. Would appreciate any help. Thanks in advance!

Recommended Answers

All 3 Replies

Your "submit" is a link tag, which does not submit automatically. You either need to use Javascript code to trigger the submit, or use <input type="submit"/>

+1 to pritaeas..

I suggest you also want to look at using $('#contact-form').serializeArray() method which will return an array of names and values from elements on your form rather than selecting your form elements over and over.

thnx a heap pritaeas.. i did some research with your guidance... and the code below does the job:

<div class="buttons"><strong><a class="button" data-type="reset">Reset<span></span></a></strong><strong><a class="button" data-type="submit" href="javascript:{}" onclick="document.getElementById('contact-form').submit();">Submit<span></span></a></strong></div>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.