“Formulir Tindakan dalam HTML” Kode Jawaban

Formulir Tindakan untuk Halaman ini di HTML

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

Formulir Tindakan dalam 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

Metode HTML Form Action JavaScript

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

Jawaban yang mirip dengan “Formulir Tindakan dalam HTML”

Pertanyaan yang mirip dengan “Formulir Tindakan dalam HTML”

Lebih banyak jawaban terkait untuk “Formulir Tindakan dalam HTML” di HTML

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya