Связывание jQuery .submit()
сообщение с полным обработчиком dropzone file upload
приводит к отправке всех правильных данных, за исключением того, что скрытые поля ввода отсутствуют. Код - все php
и jquery/js
.submit() не включает скрытые поля
Не могу найти ничего о том, почему они будут исключены.
Все скрытые поля в форме, и оба названия и идентификатор заполнены
<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(" 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(" Uploaded: 0%");
}
}
}).bind('fileuploadsubmit', function (e, data) {
data.formData = {
name: $('#uploadname').val(),
memberid: $('#memberidupload').val(),
transid: $('#acctfilesubID').val(),
amount: $('#AmountOwed').val()
};
});
</script>
</code>
</pre>
Я думаю, что скрытые поля не отправляются - попробуйте 'visibility: none' при построении form – jitendrapurohit
Ваши 'скрытые' поля должны находиться внутри вашей' формы' – Rayon
Имеет ли атрибут 'name'? –