owldesign / QARR

Grow your business by allowing visitors to leave reviews or ask a questions.
https://qarr.tools
Other
6 stars 5 forks source link

[Feature request] File upload #16

Closed 23d1 closed 5 years ago

23d1 commented 5 years ago

It would be great to be able to include an assets field in the displays that can be used to upload images connected to a question or review. Not sure if or how this is doable within custom templates.

owldesign commented 5 years ago

@23d1 Yeah I was trying to wrap my head around how to do Displays for custom templates.

Only way I can think is you provide display handle and recreate those fields making sure field handle names match.. for example:

<input type="hidden" name="displayHandle" value="extraFieldsDisplay">

and in your display you would have these for example

image

Then your form would need to be something like this..

<input type="hidden" name="displayHandle" value="extraFieldsDisplay">

<input type="text" name="fields[yourLocation]" placeholder="Enter your location" />

<select name="fields[yourGender]>
    <option value="male">Male</option>
    <option value="female">Female</option>
</select>

To the topic of the file uploads, it would work simiar, add field to display then add it to form..

<input type="file" name="fields[assetHandleName][]" />

If people chose to go the custom template way and still use displays, this seem ok to me. What you think?

23d1 commented 5 years ago

I think that sounds good. The only trouble I have is that asset fields are not showing up under displays. Not sure if it's a user error. :)

owldesign commented 5 years ago

Hey, I didn't have assets as allowed field type yet. V 1.1.6 I pushed up should now have access to Assets.

Here's more docs on the topic https://docs.qarr.tools/custom/displays/

23d1 commented 5 years ago

You are a gem! Thanks! Should be done with the trial soon and put some dollars into it for the build I'm working on. :)