“Formulaire Action en HTML” Réponses codées

Formulaire d'action pour cette page en html

<form action="#" method="GET">
  <label for="username">Username:</label>
  <input type="text" id="username" name="username" required>
  <input type="submit">
</form>
Powerful Piranha

Formulaire Action en HTML

<!--Answer from W3 Schools-->
<form action="/action_page.php">
  <label for="username">Username:</label>
  <input type="text" id="username" name="username" required>
  <input type="submit">
</form>
Old Pizza

Méthode JavaScript de l'action du formulaire HTML

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:\n" + reason);
    } else {
        simpleCart.checkout();
    }
    return false;
}
Eager Elephant

Réponses similaires à “Formulaire Action en HTML”

Questions similaires à “Formulaire Action en HTML”

Plus de réponses similaires à “Formulaire Action en HTML” dans HTML

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code