フォームを検証するためにHTMLフォームとスクリプトを作成しました。問題は、フォームを提出するたびに、「あなたのファイルが見つかりませんでした」というページにリダイレクトされることです。別のページにリダイレクトせずにHTMLとjQueryを使用してフォーム検証を行う方法は?
スクリプトを呼び出す特定の方法はありますか?それとも私をリダイレクトせずに動かすことができますか?
<form id="bioform" action="/action_page.php">
<label>Biography</label><br>
<textarea placeholder="Enter bio here" name="bio" rows="10" cols="50"></textarea><br><br>
<label>Update Biography Picture</label><br><br>
<input type="file" name="bioimage"><br><br>
<button type="submit" onclick="function()">Update</button><br>
</form>
<script>
$(document).ready(function() {
$('#bioform').validate({
rules: {
bio {
required: true,
minlength: 5,
},
}
messages: {
bio {
required: 'Please enter a biography.',
minlength: 'Please enter a valid biography.',
},
}
});
});
</script>
違いはありませんように見えること。私は私のディレクトリにaction_page.phpというファイルを作成する必要がありますか?私はそれが自動的に作成されると仮定していました。 –
あなたのディレクトリにaction_page.phpファイルを作成していませんか?あなたは投稿された値をどこで取得しましたか? –
ディレクトリにファイルを作成したくない場合は、 –