Skip to content

Fix preview & submit button on application form#4510

Merged
frjo merged 1 commit into
mainfrom
fix/submission-preview
Apr 21, 2025
Merged

Fix preview & submit button on application form#4510
frjo merged 1 commit into
mainfrom
fix/submission-preview

Conversation

@theskumar
Copy link
Copy Markdown
Member

If the submit button is disabled before submit event is processed by the borwser, the name/value on the button is not included in the form value.

This PR fixes that by using setTimeout.

There are other minor updates to js, e.g. iterating on submit buttons instead of processing only the first submit button.

Some formatting update html is also there - helps keep html readiable and for better git diff in future.

Fixes #4497

Test Steps

  • Hitting the "Preview and Submit" works as expected.

If the submit button is disabled before submit event is processed by the
borwser, the name/value on the button is not included in the form value.

This PR fixes that by using setTimeout.

There are other minor updates to js, e.g. iterating on submit buttons
instead of processing only the first submit button.

Some formatting update html is also there - helps keep html readiable
and for better git diff in future.
@theskumar theskumar requested review from Copilot, frjo and wes-otf April 19, 2025 13:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses an issue with the "Preview and Submit" button by ensuring that its name/value is included in the form submission. Key changes include:

  • Replacing the single submit button selection with iterating over all submit buttons.
  • Introducing a setTimeout with 0 delay to schedule the disabling of buttons.
  • Adding the passive option to event listeners and minor HTML formatting updates.
Files not reviewed (1)
  • hypha/apply/funds/templates/funds/application_base.html: Language not supported

Comment thread hypha/static_src/javascript/application-form.js
button.textContent = "Submitting...";
}
});
}, 0);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the primary fix for form not sending the preview key/value.

// 3. tab or enter key pressed
document.body.addEventListener("mousemove", unlockApplicationForm, {
once: true,
passive: true,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor optimization.

@theskumar theskumar self-assigned this Apr 19, 2025
@theskumar theskumar added Type: Patch Mini change, used in release drafter Type: Bug Bugs! Things that are broken :-/ labels Apr 19, 2025
@frjo frjo merged commit 29b0046 into main Apr 21, 2025
7 checks passed
@theskumar theskumar deleted the fix/submission-preview branch April 21, 2025 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Bugs! Things that are broken :-/ Type: Patch Mini change, used in release drafter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When SUBMISSION_PREVIEW_REQUIRED is enabled, selecting Preview and submit doesn't preview the application

3 participants