---
title: "onAssignedDocumentWillSubmit(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/onassigneddocumentwillsubmit(_:)"
---

# onAssignedDocumentWillSubmit(_:)

Adds an action to perform before submitting an assigned document.

## Declaration

```swift
@MainActor @preconcurrency func onAssignedDocumentWillSubmit(_ action: @escaping @Sendable (URL) async -> Bool) -> some View

```

## Parameters

- `action`: An asynchronous closure that receives the document URL and returns a Boolean value indicating whether to proceed with submission. Return true to continue, or false to cancel.

## Return Value

Return Value A view that executes the specified action before assigned document submission.

## Discussion

Discussion Return true to allow the submission to proceed, or false to cancel the submission. This is useful for validating document content, confirming user intent, or performing prerequisite operations. AssignedDocumentSubmissionButton(documentURL: documentURL)     .onAssignedDocumentWillSubmit { url in         // Validate the assigned document before submission         guard await isDocumentComplete(url) else {             await showAlert("Please complete all sections before submitting")             return false // Prevents submission         }         return true // Allows submission to continue     }

## See Also

### Submission

- [onAssignedDocumentDidSubmit(_:)](swiftui/view/onassigneddocumentdidsubmit(_:).md)
- [onAssignedDocumentDidWithdraw(_:)](swiftui/view/onassigneddocumentdidwithdraw(_:).md)
- [onAssignedDocumentWillWithdraw(_:)](swiftui/view/onassigneddocumentwillwithdraw(_:).md)
- [onSubmit(of:_:)](swiftui/view/onsubmit(of:_:).md)
- [submitScope(_:)](swiftui/view/submitscope(_:).md)
- [submitLabel(_:)](swiftui/view/submitlabel(_:).md)
