Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

html form action javascript method

A form action set to a JavaScript function is not widely supported, I'm surprised it works in FireFox.

The best is to just set form action to your PHP script; if you need to do anything before submission you can just add to onsubmit

Edit turned out you didn't need any extra function, just a small change here:

function validateFormOnSubmit(theForm) {
    var reason = "";
    reason += validateName(theForm.name);
    reason += validatePhone(theForm.phone);
    reason += validateEmail(theForm.emaile);

    if (reason != "") {
        alert("Some fields need correction:
" + reason);
    } else {
        simpleCart.checkout();
    }
    return false;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #html #form #action #javascript #method
ADD COMMENT
Topic
Name
2+9 =