getgrav / getgrav/grav-plugin-form

File upload field JS error on upload initiate

Open
#265 4 comments 0 reactions 0 assignees View on GitHub
more info needed question
Dominant language
PHP
Stars
64
Forks
80
Avg merge
10h 13m
Merged PRs (30d)
9

Description

Using the latest version (v2.15.0) of the forms plugin I am seeing a JS error when attempting to upload files in a front end form.

Error: Uncaught TypeError: Cannot read property 'trim' of undefined

Screen shot attached.
![screen shot 2018-06-14 at 11 57 09 am](https://user-images.githubusercontent.com/1262454/41390269-42c52032-6fd8-11e8-95d0-53277cd54c1f.png)

File field in .md file:

`-
name: header_background
label: 'Header Background'
type: file
destination: '@self'
multiple: false
accept:
- image/*
`

Steps to reproduce:

Create a page with a front end form, add a file field with basic config. Navigate to the form page and attempt to upload a file using the form field. The form field will remain empty, and in the console the error will show.

I've tried this across two separate grav sites with the same result.

I've attempted to start debugging this and got as far as the issue being related to the previewTemplate - it appears to not be being set from the dropzone options array, but I'm unsure why.

Let me know if you need further info.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the error in a front-end form using the shown .md file field configuration, then inspect how the previewTemplate is populated in the Dropzone options. Confirm the fix by ensuring the file field accepts an upload without the trim error and no longer remains empty.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.