Skip to content

Commit

Permalink
Fix form validation with js disabled (#41947)
Browse files Browse the repository at this point in the history
* Only add the $page query param to form submission url when the form is multipage

* changelog

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/13535850362

Upstream-Ref: Automattic/jetpack@ba1ee78
  • Loading branch information
talldan authored and matticbot committed Feb 26, 2025
1 parent 11a1929 commit cb595a7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.39.1-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Fixed
- Forms: Fix 404 error when a user submits an invalid form with JavaScript disabled.

## [0.39.0] - 2025-02-24
### Changed
- Forms: Add Tracks when connecting Google Drive. [#41825]
Expand Down Expand Up @@ -857,6 +864,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a new jetpack/forms package [#28409]
- Added a public load_contact_form method for initializing the contact form module. [#28416]

[0.39.1-alpha]: https://github.com/automattic/jetpack-forms/compare/v0.39.0...v0.39.1-alpha
[0.39.0]: https://github.com/automattic/jetpack-forms/compare/v0.38.0...v0.39.0
[0.38.0]: https://github.com/automattic/jetpack-forms/compare/v0.37.1...v0.38.0
[0.37.1]: https://github.com/automattic/jetpack-forms/compare/v0.37.0...v0.37.1
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-forms",
"version": "0.39.0",
"version": "0.39.1-alpha",
"description": "Jetpack Forms",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/forms/#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion src/class-jetpack-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class Jetpack_Forms {

const PACKAGE_VERSION = '0.39.0';
const PACKAGE_VERSION = '0.39.1-alpha';

/**
* Load the contact form module.
Expand Down
4 changes: 2 additions & 2 deletions src/contact-form/class-contact-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public static function style_on() {
* @return string HTML for the concat form.
*/
public static function parse( $attributes, $content ) {
global $post, $page; // $page is used in the contact-form submission redirect
global $post, $page, $multipage; // $page is used in the contact-form submission redirect
if ( Settings::is_syncing() ) {
return '';
}
Expand Down Expand Up @@ -346,7 +346,7 @@ public static function parse( $attributes, $content ) {
} else {
// Submit form to the post permalink
$url = get_permalink();
if ( $page ) {
if ( $multipage && $page ) {
$url = add_query_arg( 'page', $page, $url );
}
}
Expand Down

0 comments on commit cb595a7

Please sign in to comment.