Skip to content

Commit 5a42e1e

Browse files
authored
[Blazor] - Issue calling submitRequest on data-enhanced form
Co-authored-by: Adit Sheth <[email protected]> Fixes #58244 This PR fixes an issue where calling requestSubmit on a form with the data-enhance attribute caused an uncaught TypeError due to accessing a member on a null event.submitter. The change replaces the non-null assertion operator (!) with the optional chaining operator (?) to properly handle cases where event.submitter is null.
1 parent a122a40 commit 5a42e1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Components/Web.JS/src/Services/NavigationEnhancement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function onDocumentSubmit(event: SubmitEvent) {
144144
const formData = new FormData(formElem);
145145

146146
const submitterName = event.submitter?.getAttribute('name');
147-
const submitterValue = event.submitter!.getAttribute('value');
147+
const submitterValue = event.submitter?.getAttribute('value');
148148
if (submitterName && submitterValue) {
149149
formData.append(submitterName, submitterValue);
150150
}

0 commit comments

Comments
 (0)