I have a cred form with the following div where a user is able to upload an image using the standard wordpress upload method. The image in the below scenario gets assigned to the standard wordpress field: featured image.
<div class="form-group">
<label>Scorecard</label>
[cred_field field="_featured_image" output="bootstrap"]
</div>
I want to modify this so it's simpler for users to upload a file and so for this; I'm wanting to modify it to the following:-
<input type="file" id="_featured_image" name="_featured_image" field="_featured_image" accept="image/jpeg,image/png,jpg|png">
The image in this scenario though is not saving against the _featured_image field.
Any thoughts on this?
Hello,
There isn't such a built-in feature within Toolset Forms plugin, you can consider custom JS codes, for example, edit your post form, click "JS Editor" and add below JS codes:
jQuery(document).on('cred_form_ready', function() {
jQuery('[name="_featured_image"]').attr('accept', 'image/jpeg,image/png,jpg|png');
});
More help:
hidden link
Hi Luo,
You've answered a part of my question (thank you for this) but the main issue I'm trying to actually resolve is force the file input type so that the UI forces the user to upload a file without giving them the option to select one that is already loaded (see attached screenshot)
<em><u>hidden link</u></em>
Please let me know if this is possible.
The following code works perfectly but the image just doesn't save to _featured_image field
<input type="file" id="_featured_image" name="_featured_image" field="_featured_image" accept="image/jpeg,image/png,jpg|png">
You can try this, edit your post form, in section "Settings", disable option "Use the WordPress Media Library manager for image, video, audio, or file fields", and test again.