jquery validation pluginとzend frameworkを使用しています。私はテーブルに私のフォームを持っています。私はテキストフィールドが検証されていないときにエラーとしてイメージを表示しています。エラーイメージは、同じtdのテーブルのテキストボックスのすぐ隣に表示されます。しかし、同じtrの次のtdにエラーメッセージ/イメージを表示したい。例えばjQuery Validation Plugin:テーブルの次の列(td)にエラーメッセージ/画像を表示
これは以前に提出されています
<table><tr><td>First Name</td><td><input type="text" class="required" /></td><td></td></tr></table>
を、私は、これが後の空のフィールドに提出したい:
<table><tr><td>First Name</td><td><input type="text" class="required" /></td><td><img id='exclamation' src='images/exclamation.gif' title='This field is required.' /></td></tr></table>
私はこれを使用していますが、今の機能をJS:
$(obj).find("input.required").each(function(){
$(this).rules("add", {
required: true,
minlength: 2,
messages: {
required : "<img id='exclamation' src='images/exclamation.gif' title='This field is required.' />",
minlength: "<img id='exclamation' src='images/exclamation.gif' title='At least 2 characters.' />"
}
});
});