getgrav / getgrav/grav-plugin-form

Form names cannot be numbers

Open
#424 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
64
Forks
80
Avg merge
10h 13m
Merged PRs (30d)
9

Description

Goal: submitted form returns saved values in numerical order like:

Name: hunterdg
1: answer to Q1
2: answer to Q2

---

Originally I struggled to create simple numbered form fields at all due to `("Trying to access array offset on value of type int")`.

fields:
- name: 1
- name: '2'

---

I found that prefixing numbers with `.` works _for rendering_, but nut for submitted form data

fields:
- name: Name
- name: '.1'
- name: '.2'
- name: ' 3'
- name: ' 4'

returns

Name: hunterdg
.1: null
.2: null
3: 3
4: 4

(3 and 4 are prefixed with spaces)

Is this a bug or should I work around it?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the YAML examples in the issue and trace how numeric field names are handled during rendering and form submission. Reproduce the difference between numeric, dot-prefixed, and space-prefixed names; done means numbered fields render and submitted values preserve the intended names and answers.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.