getgrav / getgrav/grav-plugin-form
Grav frontend file uploading not working properly
- Dominant language
- PHP
- Stars
- 64
- Forks
- 80
- Avg merge
- 10h 13m
- Merged PRs (30d)
- 9
Description
Created a grav frontend form with file uploading feature. Except file upload everything working fine. When i trying to upload file, getting some errors from 'form.vendor.js' and file field seems to be empty after getting error. Errors given below
form.vendor.js:5 Uncaught TypeError: Cannot read properties of undefined (reading 'trim')
at D.addedfile (form.vendor.js:5:11362)
at D.value (form.vendor.js:5:1513)
at D.value (form.vendor.js:5:25886)
at HTMLInputElement. (form.vendor.js:5:17561)
Form full definition given below
title: 'Job apply form'
published: true
body_classes: job-apply-main-page
cache_enable: false
visible: true
form:
name: job-apply
id: job-apply
action: ' '
fields:
-
name: job
label: Job
autocomplete: 'off'
type: text
validate:
required: false
-
name: applicantName
label: 'Name of Applicant *'
autocomplete: 'off'
type: text
validate:
required: true
message: 'Please enter the applicant name'
-
name: email
label: Email
type: email
validate:
required: false
-
name: coverletter
label: 'Cover Letter'
type: textarea
validate:
required: false
-
name: resumefile
label: Resume
placeholder: 'Upload Resume'
type: file
destination: user/data/resume
accept:
- .pdf
- .doc
- .docx
multiple: false
-
name: toEmail
label: 'Hidden Field'
type: text
outerclasses: hide-input-field
validate:
required: false
-
name: enquiry-g-recaptcha-response
label: Captcha
type: captcha
id: enquiry-captcha
outerclasses: captcha-field
recaptcha_not_validated: 'Captcha not valid!'
validate:
required: true
buttons:
-
type: submit
value: Save
process:
-
email:
subject: '{{form.value.hiddenField}}'
from: '{{ config.plugins.email.from }}'
to:
- test@gmail.com
body: '{% include ''forms/data.html.twig'' %}'
attachments:
- resumefile
-
email:
subject: '{{form.value.hiddenField}}'
from: '{{ config.plugins.email.from }}'
to:
- '{{ form.value.email }}'
body: '{% include ''forms/apply.html.twig'' with { "message": "Thank you for your Inquiry. We will get back you soon" } %}'
-
save:
fileprefix: feedback-
dateformat: Ymd-His-u
extension: txt
filename: site-enquire.txt
operation: add
body: '{% include ''forms/data.txt.twig'' %}'
attachments:
- resumefile
-
message: 'Thank you for your feedback!'
reset: true
Grav and other plugins updated to latest version
Grav v1.7.27.1
Admin v1.10.27
Form v5.1.4
Contributor guide
No contributing guide indexed for this repository
Research direction
Begin with the supplied form definition and the form.vendor.js stack trace; reproduce the resumefile upload using the listed Grav 1.7.27.1, Admin 1.10.27, and Form 5.1.4 versions. Done means identifying and fixing the upload failure so the file field is retained and the configured email and save attachment processing succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, php
- Domain
- backend, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100