Answers.Body: <p>Solved it for now by making the file input hidden first and only changing its type attribute to file (using jquery) once the asset get’s deleted, ajax-style.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-25T20:04:49.997Z
Answers.Text: I have a similar set up. Users can publish entries that contain an asset field which is set to "required". They should also be able to edit these entries. In my edit form, I have a hidden field for the asset: `<input type="hidden" name="fields[imageFile]" value="">` I'm not sure what, if anything, to put as the value. The form is not saving because required field not filled in. Is JavaScript (jQuery, other) the only way? If so, would you be willing to share your solution in more detail? Is there another, non JS, solution?
Answers.UserDisplayName: Andrea DeMers
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-25T21:22:14.003Z
Answers.Text: It looks like I got it working with hidden field as follows:
  
  `<input type="hidden" name="fields[imageFile][]" value="{{ image.id }}">`
Answers.UserDisplayName: Andrea DeMers
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-29T07:32:16.340Z
Answers.Text: Hi Andrea. It was national holiday here in Germany so I only now had time to look into it. You got it working?
Answers.UserDisplayName: Marcus Scheller
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-20T19:22:23.210Z
Answers.Text: Hi Marcus, after some time away from this project, I've come back to it  to discover that my solution above does not work after all. Would it still be possible to share your JS solution? Thanks!
Answers.UserDisplayName: Andrea DeMers
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-23T06:53:02.340Z
Answers.LastActivityDate: 2014-10-23T06:53:02.340Z
Answers.UserDisplayName: Marcus Scheller
Body: <p>Since file inputs are not allowd to be pre-populated, how do i tell craft that a required asset field is already filled in the front end edit form? Can’t seem to figure this one out.</p>
  
  <p>Edit:
  Users can create entries from the front end. Those entries have at least one required field which is an asset (image). Creating an entry works fine. However, when editing an entry the user should be able to change the asset as well so we give them the file input too when editing the entry. If they choose to leave that alone the entry couldn’t get saved since the file input stays empty but is still required.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-22T17:56:14.350Z
Comments.Text: Can you post more detail? Not really clear what you’re trying to do here.
Comments.UserDisplayName: Brandon Kelly
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-22T21:39:34.870Z
Comments.Text: Users can create entries from the front end. Those entries have at least one required field which is an asset (image). Creating an entry works fine. However, when editing an entry the user should be able to change the cover as well so we give them the file input too when editing the entry. If they choose to leave that alone the entry couldn’t get saved since the file input stays empty but is still required.
  
  Solved it for now by making the file input `hidden` first and only changing its type attribute to `file` (using jquery) once the cover get’s deleted, ajax-style.
  
  Makes sense?
Comments.UserDisplayName: Marcus Scheller
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-22T21:42:33.383Z
Comments.Text: Yes the JavaScript solution is going to be your best bet here. You should post that as an official answer to the question ;)
Comments.UserDisplayName: Brandon Kelly
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-22T21:44:53.100Z
Comments.Text: Cool. Will do :)
Comments.UserDisplayName: Marcus Scheller
Tags: <assets><form><field><required>
Title: Front end edit required asset
ThreadText: # Front end edit required asset
  
  (Asked by: username_0 on 2014-10-21)
  
  Since file inputs are not allowd to be pre-populated, how do i tell craft that a required asset field is already filled in the front end edit form? Can’t seem to figure this one out.
  
  Edit:
  Users can create entries from the front end. Those entries have at least one required field which is an asset (image). Creating an entry works fine. However, when editing an entry the user should be able to change the asset as well so we give them the file input too when editing the entry. If they choose to leave that alone the entry couldn’t get saved since the file input stays empty but is still required.
  
  **Tags:** assets, form, field, required
  
  > **Comments:**
  > **username_1**: Can you post more detail? Not really clear what you’re trying to do here.  
  > **username_0**: Users can create entries from the front end. Those entries have at least one required field which is an asset (image). Creating an entry works fine. However, when editing an entry the user should be able to change the cover as well so we give them the file input too when editing the entry. If they choose to leave that alone the entry couldn’t get saved since the file input stays empty but is still required.  Solved it for now by making the file input `hidden` first and only changing its type attribute to `file` (using jquery) once the cover get’s deleted, ajax-style.  Makes sense?  
  > **username_1**: Yes the JavaScript solution is going to be your best bet here. You should post that as an official answer to the question ;)  
  > **username_0**: Cool. Will do :)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2014-10-23. Score: 1 | Accepted answer
  
  Solved it for now by making the file input hidden first and only changing its type attribute to file (using jquery) once the asset get’s deleted, ajax-style.
  
  > **Comments:**
  > **username_2**: I have a similar set up. Users can publish entries that contain an asset field which is set to "required". They should also be able to edit these entries. In my edit form, I have a hidden field for the asset: `<input type="hidden" name="fields[imageFile]" value="">` I'm not sure what, if anything, to put as the value. The form is not saving because required field not filled in. Is JavaScript (jQuery, other) the only way? If so, would you be willing to share your solution in more detail? Is there another, non JS, solution?  
  > **username_2**: It looks like I got it working with hidden field as follows:  `<input type="hidden" name="fields[imageFile][]" value="{{ image.id }}">`  
  > **username_0**: Hi username_2. It was national holiday here in Germany so I only now had time to look into it. You got it working?  
  > **username_2**: Hi username_0, after some time away from this project, I've come back to it  to discover that my solution above does not work after all. Would it still be possible to share your JS solution? Thanks!  
  
  ---
  
  