.submit()不包括隐藏字段

时间:2015-10-07 06:51:52

标签: javascript php jquery post submit

将jQuery .submit()帖子绑定到dropzone file upload完整处理程序会导致发送所有正确的数据,除非它缺少隐藏的输入字段。代码全是phpjquery/js

无法找到有关为何将这些内容排除在外的任何内容。

所有隐藏字段都在表单中,并且名称和ID都已填充

<pre>
<code>
<form id="payments" method="post" action="<?php $_SERVER['PHP_SELF'] ?>" class="form-horizontal" >

<input type="hidden" name="transID" value="<? if(isset($values['transID'])){echo $values['transID'];}else{ echo $transID; } ?>" />
<input type="hidden" name="transID" value="<? if(isset($values['transID'])){echo $values['transID'];}else{ echo $transID; } ?>" />
<input type="hidden" id="pdflink" name="pdflink" value="<? if(isset($values['pdflink'])){echo $values['pdflink'];} ?>" />
<input type="button" name="btnSubmit" value="Submit PDF & Payment(s)" onclick="this.disabled" id="btnSubmit" class="col-md-6 btn btn-primary raised" />
</form>
<script>
$('#upload').fileupload({

// This element will accept file drag/drop uploading
autoUpload: true,
dropZone: $('#drop'),
limitMultiFileUploads:1,
maxNumberOfFiles: 1,
fileInput: $('#upl'),
url: 'acctfilesupload',
dataType: 'text',

// This function is called when a file is added to the queue;
// either via the browse button, or via drag/drop:
add: function (e, data) {

var tpl = $('<li class="working"><p></p></li>');

// Append the file name and file size
tpl.find('p').text("Submitted File: " + data.files[0].name).append('  <i>' + formatFileSize(data.files[0].size) + '</i>');

// Add the HTML to the UL element
data.context = $(ul).html(tpl);


// upload the file once it is added to the queue
$('#btnSubmit').click(function(){
var jqXHR = data.submit();})
},

progressall: function (e, data) {
var progress = parseInt(((data.loaded / data.total * 85)+ 15), 10);
$('#uploadprogress').css('width', progress + '%').html("&nbsp;&nbsp;Uploaded: " + progress + '%');
    },
done: function(e, data){
var r = data.result;
if (r.lastIndexOf("\\\\FShost\\Accounts", 0) === 0) {
$('#pdflink').val(r);
$('#payments').submit();
} else {
alert(r);
$('#btnSubmit').prop('disabled',false);
$('#uploadprogress').css('width','15%').html("&nbsp;&nbsp;Uploaded: 0%");
}
}
}).bind('fileuploadsubmit', function (e, data) {
data.formData = {
name: $('#uploadname').val(),
memberid: $('#memberidupload').val(),
transid: $('#acctfilesubID').val(),
amount: $('#AmountOwed').val()
};
});

</script>
</code>
</pre>

1 个答案:

答案 0 :(得分:0)

发现它!问题是在一个表单中可以提交的最大字段数中使用php的硬限制。恰好是提交该限制的最后一个字段也恰好是隐藏字段出现在POST之前的最后一个字段