私はjQuery Validateを使用しており、このフォーラムで回答を探しましたが、accept引数を追加するときに失敗する部分に苦労しています。
私はこのコードを持っています
$("#addNewDocumentForm").validate({
rules: {
inputDocument: { required: true, accept: "png|jpe?g|gif|pdf" }
},
messages: {
inputDocument: "File must be PDF, DOCX, JPG, GIF or PNG, less than 1MB"
},
submitHandler: function(e) {
/* stop form from submitting normally */
event.preventDefault();
/* get some values from elements on the page: */
var $form = $("#addNewDocumentForm"),
inputDocument = $('#inputDocument').val();
url = $form.attr( 'action' );
/* Send the data using post */
var posting = $.post( url, { inputDocument: inputDocument} );
/* Put the results in a div */
posting.done(function( data ) {console.log(data) });
posting.fail(function() { alert("This document could not be added at this current time."); })
}
});
$('#saveDocument').on('click', function(e){
$('#addNewDocumentForm').submit();
});
問題は、フォームを保存するとき(つまり、フォームを検証するとき)にこのエラーが発生することです
e.validator.methods[o] は定義されていません [このエラーでブレーク]
...,t;for(e=0;this.errorList[e];e++){var n=this.errorList[e];if(this.settings.highl...