Hi there
I’m trying to validation on my form which only has 1 element in it. Simple enough but it took me hours, probably because I’m in a highly pissed state.
<html>
<head>
<script type="text/javascript">
function validate_form() {
//with (thisform) {
var id = document.sid.search_id;
if (isInteger(id.value)) {
return true;
} else {
alert("This is not a valid ID!");
return false;
}
//}
}
</script>
</head>
<body>
<form name="sid" onsubmit="return validate_form()">
<input type="text" name="search_id"/>
<input type="submit" value="submit"/>
</form>
</body>
</html>
It doesn’t work. When I press submit, it passes the code as if it isn’t there. No matter what I put inside the text field, valid or not valid, it doesn’t work.
I only have JS experience of less than 24 hours. I’m just trying to get something up and running on my website desperately. Sorry if my question sounds stupid. :eyeup:
Anyway, thanks in advance.