Automattic / Automattic/jetpack

Contact Form: form fields reset on validation error for logged in admins

Open
#24,900 0 comments 0 reactions 0 assignees View on GitHub
[Feature] Forms [Plugin] Jetpack [Pri] Low Bug
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

It seems like a _required_ `Checkbox Group` field doesn't block submission prior to refreshing the page like some other fields do. As mentioned below, this can cause logged in admins to lose other data they have entered on the form.

**To reproduce:**

- Add a simple Jetpack Contact form to a test post (I used name, message, and a required checkbox **group**).
- Open the form in a private browsing window and fill it out while skipping the checkbox group field.
- On submission, a form error should generate, but the other fields like message/name should persist their data.
- Now, try again from a new private window while logged in as a site admin. When the form error generates this time you'll notice all form fields are emptied.
- You can try again while logged in as a subscriber, which should persist form data on error.

**Suggestions:**

Could the Checkbox Group block invalid attempts (via JS) before page refresh like other fields do?

Screen Shot 2022-06-29 at 3 00 13 PM

**Meta:**

Reported internally via: p8oabR-T0-p2#comment-6423

I also wonder if there is any common thread with #12975 with regards to being logged in or not.

Contributor guide

Open the contributing guide

Research direction

Reproduce the Jetpack Contact form issue with a required Checkbox Group in private windows, comparing logged-out users, admins, and subscribers. Start at the Contact form and Checkbox Group validation behavior; done means submitting without the required group shows an error while preserving the other fields for logged-in admins.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php, wordpress
Domain
backend, 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.