送信する前に新しい入力を追加する必要があるため、ラウンドアバウト方式で送信するフォームを取得しようとしています。実際の$(form).submit()関数に追加を配置しても投稿用に追加が収集されないため、submitCheck()を呼び出してから実際の関数を送信するためのhtmlボタンを追加しました。
function init() {
$("#submit").click(submitCheck);
//and lots of other stuff
}
function submitCheck() {
//go through fabric canvases, save xml to input.
for (var i=1; i<probNum; i++) {
var csvg = gcanvas[i].toSVG();
$('#output').append("<input type='hidden' name='svg"+probNum+"' value='"+csvg+"'></input>");
}
//make sure a topic was selected. If not cancel submission and don't do anything.
if ($("#topic").val() == '-1')
{
$('#error').html("You must select a valid topic");
} else {
//submit the form
alert('should submit now');
$("form:first").submit();
}
}
しかし...失敗し、タイプエラーがスローされます:
TypeError: f[s] is not a function
この特定のエラーに関するドキュメントは見つかりませんでした。何か案は?