0

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

,submitFu:function(){
_.validateFu(_.labels)                          
if(!_.form.has('.'+_.invalidCl).length)
    $.ajax({
        type: "POST",
        url:_.mailHandlerURL,
        data:{
            name:_.getValFromLabel($('.name',_.form)),
            email:_.getValFromLabel($('.email',_.form)),
            phone:_.getValFromLabel($('.phone',_.form)),
            //fax:_.getValFromLabel($('.fax',_.form)),
            //state:_.getValFromLabel($('.state',_.form)),
            message:_.getValFromLabel($('.message',_.form)),
            owner_email:_.ownerEmail,
            stripHTML:_.stripHTML
        },
        success: function(){
            _.showFu()
        }
    })          
},
showFu:function(){
_.success.slideDown(function(){
    setTimeout(function(){
        _.success.slideUp()
        _.form.trigger('reset')
    },_.successShow)
})
},

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>
<fieldset>
    <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>
    <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>
    <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>
    <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>
    </label>
    <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>
</fieldset>
</form>

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

3
Contributors
3
Replies
23
Views
4 Years
Discussion Span
Last Post by thetwig
1

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

+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.

Edited by pritaeas: Added markdown

1

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>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.