Move working form to wordpress & validation fails

Discussion in 'Blogging' started by bellcom, Jan 28, 2014.

  1. #1
    So I have a form here on a simple html page with just a few required fields. Leave everything blank & hit submit and you see how validation works.
    http://dancematrix.net/samplepage.html

    So I tried to move it to a wordpress page a couple different ways but can't get it to work, it ignores validation and submits the form, or least goes to the next step where it asks for a captcha:
    http://dancematrix.net/sample4/

    I don't need jquery because its called by wordpress right?
    <script src="http://code.jquery.com/jquery-1.7.2.js"></script>

    I called the validate script by adding before </head> in the header.php of my wordpress theme:
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>

    Then copied the form html along with the javascript as I have on the simple form to a wordpress page with the text editor.

    Is there sometimes a conflict by calling scripts in the wrong order in the header file?
    Any quick and easy fixes :)

    thanks!!
     
    bellcom, Jan 28, 2014 IP
  2. Hefaistos

    Hefaistos Active Member

    Messages:
    194
    Likes Received:
    14
    Best Answers:
    9
    Trophy Points:
    63
    Digital Goods:
    1
    #2
    Nowadays, WordPress has the wp_enqueue_script() and , wp_enqueue_style() functions, which you should use to include external jQuery plugins and stylesheets to your theme to avoid the conflicts (functions that you need to call in functions.php file). Also, the latest WordPress version has its own jQuery version included, so there is no need to include it again. Also, if the form action is pointing to other file, other that with the HTML code, make sure that the path to that file is correct.
    Also, by not including the right way the javascript files, you can encounter conflicts between the files included by plugins and the files included by your current theme.
     
    Hefaistos, Jan 29, 2014 IP