I have a page with 2 input text and 2 input file When I get the answer from ajax, I clear the entire form as per the code below, but only one field is not cleared the field:
<input class="fileUploadAudio" id="fileUploadAudio" name="fileUploadAudio" type="file"></span>
I think there must be some conflict, I've done everything and I can not clean this blessed field.
<div class="form-group">
<label class="col-sm-3 control-label">Imagem para Push</label>
<div class="col-sm-6">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-new thumbnail" style="width: 200px; height: 150px;">
<img src="http://placehold.it/190x140/7761A7/ffffff"alt="...">
</div>
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px;"></div>
<div>
<span class="btn btn-primary btn-file"><span class="fileinput-new">Selecionar imagem</span><span class="fileinput-exists">Alterar</span>
<input class="arquivo" id="arquivo" name="arquivo" type="file"></span>
<a href="#" class="btn btn-danger fileinput-exists" data-dismiss="fileinput">Remover</a>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Áudio para a campanha</label>
<div class="col-sm-6">
<div class="fileinput fileinput-new" data-provides="fileinput">
<input name="..." value="" type="hidden">
<span class="btn btn-primary btn-file"><span class="fileinput-new">Selecionar áudio</span>
<span class="fileinput-exists">Alterar</span>
<input class="fileUploadAudio" id="fileUploadAudio" name="fileUploadAudio" type="file"></span>
<span class="fileinput-filename"></span>
<a href="#" class="close fileinput-exists" data-dismiss="fileinput" style="float: none">×</a>
</div>
</div>
</div>
In the ajax return I have to clear the form fields as follows:
$(".formulario")[0].reset();
$(".formulario").get(0).reset();
$('#cancelButton').hide();
$("#fileUploadAudio").val("");
$('#submitButton').hide();
I even tried to clean only the fileinput this way:
$('#fileUploadAudio').val('');