Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avatar upload in form, when click reset button, the preview image is hidden #1059

Closed
anhchungite opened this issue Aug 27, 2017 · 0 comments
Closed

Comments

@anhchungite
Copy link

Everything is wonderful until I click reset button.
My code html:

<form class="form-validate form-horizontal" id="user_form" method="post" enctype="multipart/form-data">    
    <div class="kv-avatar center-block text-center" style="width:200px">
           <input id="avatar-1" name="hinhanh" type="file" class="file-loading">
    <div class="help-block"><small>Allow size < 1000 KB</small></div>
    <input type="submit" class="form-control">
    <input type="reset" class="form-control">
</form>

and javascript config code:

$("#avatar-1").fileinput({
    overwriteInitial: true,
    maxFileSize: 1500,
    showClose: false,
    showCaption: false,
    showBrowse: false,
    browseOnZoneClick: true,
    removeLabel: '',
    removeIcon: '<i class="glyphicon glyphicon-remove"></i>',
    removeTitle: 'Cancel or reset changes',
    elErrorContainer: '#kv-avatar-errors-2',
    msgErrorClass: 'alert alert-block alert-danger',
    defaultPreviewContent: '<img src="/uploads/default_avatar_male.jpg" alt="Your Avatar" style="width:160px"><h6 class="text-muted">Click to select</h6>',
    layoutTemplates: {main2: '{preview} {remove} {browse}'},
    allowedFileExtensions: ["jpg", "png", "gif"]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants