だから私が起こる必要があること:
ユーザーは 10 桁 (数字のみ) で入力し、[送信] をクリックします。送信すると、ユーザーは別のランディング ページにリダイレクトされます。
これが私がやったことです...そしてそのリダイレクトですが、実際には10文字を検証していないか、それらが数字であることを検証していません. それを行う別のスクリプトがありますが、異なるプログラミング言語を使用しているため、両方を一緒にすることはできません。
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>
<script>
$(function() {
$('#myform').submit(function() {
var myField = $('#myInput').val();
if (myField == '') {
alert('10 digit code is required');
return false;
}
// at this stage we know that the form is valid as the user
// filled the required myField. Now we can redirect
window.location.href = 'http://www.corel.com';
return false;
});
});
</script>
</head>
<body>
<form id="myform" name="form1" method="post" action="">
<label for="button"></label>
<label for="myInput"></label>
<input name="myInput" type="text" id="myInput" value="" size="12" maxlength="10" />
<input type="submit" name="button" id="button" value="Submit" />
</form>