Problem with Boostrap clear Fileinput field

Asked

Viewed 87 times

0

I have a page with 2 input text and 2 input file When I receive the answer from ajax, I have the whole form cleaned as code below, but only one field is not cleared:

<input class="fileUploadAudio" id="fileUploadAudio" name="fileUploadAudio" type="file"></span>

I believe there must be some conflict, I’ve done all I can and I can’t clear this blessed field.

Follow the page

<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>

On the return of the ajax I have the form fields cleared in this way:

$(".formulario")[0].reset();
$(".formulario").get(0).reset();
$('#cancelButton').hide();
$("#fileUploadAudio").val("");
$('#submitButton').hide();

I’ve even tried to clean only fileinput this way:

$('#fileUploadAudio').val('');
  • You can create a fiddle to demonstrate the problem?

  • Are you sure this input is inside the form? sometimes it is necessary to close a tag.

  • Console shows some error when trying to clean input?

  • Guys, I just went up the page if you can help me. follow the link - > http://williamvillar.com.br/Push_Novo/msg_big_pic.php

  • Guys, I just put a button called CLEAR. To test do the following command: select 2 files in the 2 fileinput then click on that button. ->> http://williamvillar.com.br/Push_Novo/msg_big_pic.php

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.