I'd like to add "accept" attributes to some of the input fields for my site's content types -- to end up with something like
<input type="file" id="edit-field-whatever-und-0-upload" name="files[field_whatever_und_0]" size="22" class="form-file" accept="image/*">, so that (most) browsers will limit the selectable items to .jpg, .png, etc. I've tried doing this by adding an
#attributes clause to a form's
hook_form_alter handler, but haven't been able to find the right way to write the clause -- I can't get the
accept clause to show up in the html.
In place of this, I'm currently adding it through some jQuery that runs on document.ready, but it would feel cleaner if I could do it through the forms api. Is this possible? Any hints out there? Thanks!