jQuery Validation using third party plugin
<!DOCTYPE html>
<html>
<head>
<title>Site :: </title>
<link rel="stylesheet" media="screen" href="css/wicahost.css" />
<link rel="stylesheet" media="screen" href="css/global.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
<script type="text/javascript" src="inc/js/valid.js"></script>
<SCRIPT TYPE="TEXT/JAVASCRIPT">
$(document).ready(function() {
$("#splashtease").RSV({
onCompleteHandler: myOnComplete,
rules: [
"required,emAdd,Please enter your email address.",
"valid_email,emAdd,Please enter a valid email address.",
]
});
});
</SCRIPT>
</head>
<body>
<div id="splashTeaserBox">
<h1>Signup!</h1>
<form id="splashtease" action="inc/subscribe.php" method="post">
<?php $usrBrowser = $_SERVER['HTTP_USER_AGENT']; $todayDt = date('Y-m-d'); ?>
<input type="text" name="emAdd" />
<input type="hidden" name="brwsr" value="<?php echo $usrBrowser ?>" />
<input type="hidden" name="dt" value="<?php echo $todayDt ?>" />
<input type="submit" name="submit" value="" class="splashteasesub" />
</form>
</div><!--splashTeaserBox-->
</body>
</html>
Trying to implement this simple example above to validate an email address: http://w开发者_StackOverflow中文版ww.benjaminkeen.com/software/rsv/jquery/demo.php
The above code isn't doing anything and is just submitting to the database. I checked to make sure my jquery library link reference and jquery script for this 3rd party script to make sure they linked fine and both do link fine.
Anyone see what is going wrong here? Thanks :)
You are trying to bind an onCompleteHandler
handler, but the variable you're providing does not reference a function. Rather, it is undefined. Remove it, and you'll be OK.
http://jsfiddle.net/XNXj3/
myOnComplete isn't defined. rules has an extra comma after the second item
精彩评论