www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: [RESOLVED] Need help tying JS to HTML forms for my biz website. Files included. Please help.

  1. #1
    Join Date
    Nov 2013
    Location
    Washington, USA
    Posts
    13

    resolved [RESOLVED] Need help tying JS to HTML forms for my biz website. Files included. Please help.

    I don't quite know where I went wrong, but it doesn't seem to be referenced properly or something, because neither of the forms validate or send anything to my email. I'm kind of at a loss at this point..
    Please, if anybody could help me, I would immensely appreciate it.
    Thank you so much. <3

    https://mega.co.nz/#!EE9E1ZyA!d-d-TT...DOCkrcirgFTcPg

  2. #2
    Join Date
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    780
    heh, Wow! When I downloaded the code I didn't really expect the entire website

    If you have the site live somewhere, or if you could point out in what files things are supposed to be happening, then it would make debugging the problem a lot easier.

    Right now I feel like I'm looking for a needle.
    JavaScript: Learn | Validate | Compact

  3. #3
    Join Date
    Nov 2013
    Location
    Washington, USA
    Posts
    13
    clinic4pc.com, go to the service tab and click on a form link, the forms show up but they don't have any field validation for submission, and also the php to send the form data to my email doesn't seem to be working along with it.
    Sorry about the whole package by the way, but I thought it might help if someone's looking to see where I messed up.
    Thanks so much for your help, by the way!!

  4. #4
    Join Date
    Nov 2013
    Location
    Washington, USA
    Posts
    13
    You will see the specific forms in the "HTML forms" folder. The JS and PHP folders also hold files referenced in the HTML forms.

  5. #5
    Join Date
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    780
    Ok, a few things up front before we can start debugging properly:

    Your JavaScript file isn't being included right now:

    standard_service_form.html : Line 10
    Code:
    <script src="/JS/service_js.js"></script>
    standard_service_form.html : Line 11
    Code:
    <form method="post" action="contact.php" onsubmit="return CheckForm();">
    standard_service_form.html : Line 522
    Code:
    <input type="submit" value="Submit Form" />
    (you can put the thank you message in the script file instead)

    Remember, depending on your host, case-sensitivity is also important so watch how you name files/folders. I typically just keep everything lowercase to avoid problems.

    Once we have those corrections done at least then we can look at how the validation script works

    Wow, I just realised your <form> is sitting in the <head>, it should be moved inside the <body> tag. And the <form> is being closed prematurely after the Personal Info section, that should be removed.
    Last edited by bionoid; 11-29-2013 at 01:53 AM.
    JavaScript: Learn | Validate | Compact

  6. #6
    Join Date
    Nov 2013
    Location
    Washington, USA
    Posts
    13
    Aha, I'm sorry about that. I let my boyfriend fiddle around with my forms a bit tonight, and hadn't actually done any reviewing before zipping it all up. He wrote the JS and PHP for me. Thank you very much for your help though, and thank you for letting me know about that little oopsie, I will get on to fixing that all up right away. I will mention you in my code as requested if all works properly, and let you know how it goes on here before I call this as resolved.

  7. #7
    Join Date
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    780
    Quote Originally Posted by BunnyFett View Post
    I will mention you in my code as requested if all works properly, and let you know how it goes on here before I call this as resolved.
    lol, if I'm not mistaken, I believe you have misunderstood what I meant. When I said you can put the thank you message into your script file I was referring to your original submit button message:

    Code:
    <button type="submit" onClick="alert('Thank you for filling out our order form. Your submission has been forwarded to our email and will be read and addressed within the same service day.')">Submit Form</button>
    I don't need recognition, I help out because I enjoy it I hope you come right though, good luck. And don't let your boyfriend touch your code again, heehee.
    JavaScript: Learn | Validate | Compact

  8. #8
    Join Date
    Nov 2013
    Location
    Washington, USA
    Posts
    13
    Ah, alrighty then. I already did that before reading this, but I figured you meant just an occlusion section because people can go through website scripts and whatnot.
    Anyhow it seems to partially work, but it's still broken. There's still no validation happening, and the php seems to be a bit buggy.
    Thank you anyhow for the proper html formatting, I think that part is out of the way now.
    I will have to go over my scripts more later today I guess.

  9. #9
    Join Date
    Nov 2013
    Location
    Washington, USA
    Posts
    13
    Would you know anything about php and js by chance? Shot in the dark, but still a worthy shot, aha. ^^;

  10. #10
    Join Date
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    780
    Yes, I know PHP and JavaScript as well. If the questions are related to the original problem then there should be no issue asking them in this thread. Unless of course you want to try get someone else to try assist by creating a new one :P
    JavaScript: Learn | Validate | Compact

  11. #11
    Join Date
    Nov 2013
    Location
    Washington, USA
    Posts
    13
    All of my issues are relative to the folders I've uploaded. I put the forms up on the website again, and the first thing I get upon submission is "Parse error: syntax error, unexpected T_VARIABLE in /home/clinic4p/public_html/php/contact.php on line 4". There is no validation happening as well. I appreciate your help with all of this, but if this does get to be too much work for you then I will understand if you have to stop.

  12. #12
    Join Date
    Nov 2013
    Location
    Washington, USA
    Posts
    13
    I kind of suck with most web development stuff that isn't html and css, honestly.. so any help I can get with the rest would be just wonderful.

  13. #13
    Join Date
    Nov 2013
    Location
    Washington, USA
    Posts
    13
    If you have Skype, we could type on there for faster replies, but if not then that is also fine. You seem to know what you're doing and I appreciate your help very much either way.

  14. #14
    Join Date
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    780
    Sure... I will make the request if that's ok with you. I don't want to publish my Skype details on the forum :P
    JavaScript: Learn | Validate | Compact

  15. #15
    Join Date
    Nov 2013
    Location
    Washington, USA
    Posts
    13
    Sounds fine to me. You have much more appearance on this site than I do, lol.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles