<div class="form-group">
<label><%= (I18n.t 'user.form.your_avatar')%></label>
<div class="push">
<%= image_tag @user.avatar, class: 'img-avatar' if @doctor.avatar.attached? %>
</div>
<div class="custom-file">
<%= form.file_field :avatar, class: 'custom-file-input', data: { toggle: 'custom-file-input' } %>
<%= form.label :avatar, I18n.t('doctor.form.choose_new_avatar'), class: 'custom-file-label' %>
</div>
</div>
I want to inform user once he chooses image image uploaded successfully , before submitting the data. How can this be handled? Any logic?
Then you just need a little jQuery script to add a notification after an image was chosen.
$(document).ready(function () {
$(document).on('change', '.custom-file-input', function (_e) {
alert("You've added an image!");
});
});