So the problem I'm having is I want to use JavaScript to check for empty fields and incorrect characters and things, but the problem is I can't add an action because the form action already points to a PHP file. The JavaScript works when put it in the action area, but I can't get it to work without doing that, and I need the PHP to be the action unfortunately. Here's the HTML code:
<form action="http://ift.tt/1yii2MU" method="post" name="donateNow" class="formMargin">
And here's the JavaScript.
function validateForm() {
var x = document.forms["donateNow"]["first"].value;
if (x == null || x == "") {
alert("Name must be filled out");
return false;
}
}
Aucun commentaire:
Enregistrer un commentaire