I'm uploading an Image to my Image model using formtastic Gem.
User model has many images
I've created my form using formtastic gem:
= semantic_form_for @user, :remote => true, :html => { :class => 'formtastic' } do |f|
= f.semantic_fields_for :images, @image do |image|
= image.input :file
:label => false,
:as => :file
It is required to upload an image. The form has two more fields Name and description! After choosing a file to upload it shows the chosen file name.
If I fill out all the required fields and hit submit it works perfectly fine but If I hit submit before filling out all required field then form will ask me to fill out required fields and also asks me choose the file again.
Expected behavior is that form should only ask me to fill out missing required field and it should remember previously chosen file. Does anyone know why it's doing this?
Any help will be greatly appreciated