Skip to content

web UI: fallback no-js web form for file uploads (#1364)#1560

Merged
stinkerton18 merged 1 commit intodevelopfrom
1364-web-ui-non-js-fallback-upload-form
Nov 23, 2025
Merged

web UI: fallback no-js web form for file uploads (#1364)#1560
stinkerton18 merged 1 commit intodevelopfrom
1364-web-ui-non-js-fallback-upload-form

Conversation

@rdmark
Copy link
Copy Markdown
Member

@rdmark rdmark commented Nov 22, 2025

This makes it possible to upload files from a vintage browser, for instance

Note that you have to explicitly turn off javascript in the user agent to get the fallback form

This makes it possible to upload files from a vintage browser, for instance

Note that you have to explicitly turn off javascript in the user agent to get the fallback form
@rdmark rdmark requested a review from akuker as a code owner November 22, 2025 22:52
@rdmark rdmark linked an issue Nov 22, 2025 that may be closed by this pull request
@sonarqubecloud
Copy link
Copy Markdown

@rdmark
Copy link
Copy Markdown
Member Author

rdmark commented Nov 22, 2025

The look in IE4.5!

Screenshot 2025-11-23 at 0 03 11

Copy link
Copy Markdown
Member

@nucleogenic nucleogenic left a comment

Choose a reason for hiding this comment

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

Neat 💫

<div class="noscriptmsg">
{{ _("The file uploading functionality requires JavaScript.") }}
</div>
<form id="uploadForm" action="/files/uploadform/" onchange="fileSelect(event)" method="post" enctype="multipart/form-data">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can the onchange event handler ever run from here?

Copy link
Copy Markdown
Member Author

@rdmark rdmark Nov 23, 2025

Choose a reason for hiding this comment

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

It won't ever run because it's inside a <noscript> tag ^^;

I borrowed this form markup from Eric's earlier web upload form from 2021, and forgot to clean up javascript stream upload stuff.

Comment on lines +48 to +52
<script type="application/javascript">
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("js-upload-form").style.display = "block";
});
</script>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess the other option would be to progressively enhance a shared form of DOMContentLoaded is fired. Just an observation, I don't think there's a real maintenance burden from having two forms here.

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.

Right, it felt a little icky to introduce a bunch of code duplication. A similar situation with upload_file() and upload_file_form(). I briefly tinkered with this but I concluded that the effort outweighed the benefit. Something to refactor in the future on a rainy day!

@stinkerton18 stinkerton18 merged commit 2905775 into develop Nov 23, 2025
10 checks passed
@rdmark
Copy link
Copy Markdown
Member Author

rdmark commented Nov 23, 2025

@stinkerton18 thanks for your attention to these PRs :)

in the future, please hold off on merging a PR with open conversations, such as this one

there may be valuable improvements that come out of these conversations, so I think it's important to go through and address each one

in fact, I just turned on a branch protection policy that prevents merging with open conversations so this should be a non problem from now on

@rdmark rdmark deleted the 1364-web-ui-non-js-fallback-upload-form branch November 23, 2025 10:22
@rdmark
Copy link
Copy Markdown
Member Author

rdmark commented Nov 23, 2025

filed #1565 to address the comments in this PR and add a test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web UI: Non-JS fallback upload form

3 participants