Gingerclaire_
-
Posts
5 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Gingerclaire_
-
-
Does anyone know how to change the css and text on the form to indicate an error instead of the pop up message? We've been told to use this file:
<script type="text/javascript" scr="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
but I've really no idea where to start!?
-
Thanks I've got that now!
-
Thanks guys! I've check it again and it is now validating. Just not for the name though (I can still submit it without a name).
<script type="text/javascript">function validateForm() { if (false === validate_required( document.forms["myForm"]["name"], "Name must be supplied")) { return false; } if (false === validate_required( document.forms["myForm"]["email"], "Valid email must be supplied")) { return false; } return true;}function validate_required(field, alerttxt) { if (field.value === null || field.value == "") { alert(alerttxt); return false; } else { return true; }} </script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script><script>$("document").ready(function () { $("form").validate();});</script>
-
I was wondering if someone could help me. We were learning some basic javascript in class and I can't seem to get my form to validate. Basically all I wanted it to do is return an error when nothing is entered in the field. I've done it the way we were taught in class via examples. Any help would be much appreciated!!
JavaScript Form Validation (First attempt)
in JavaScript
Posted
Does the error out message go in the div?