Prevents the default behaviour of notification form submit, where notification card gets dismissed right after submit.
addEventListener('notification-form-submitted', async (event) => {
// preventing the default submit behaviour
event.preventDefault();
// setting the form status to processing
event.setFormStatus({
formStatus: 'Processing'
});
const longOperationResult = await ...();
if (longOperationResult.hasError) {
// setting error if long-running operation has failed.
event.setFormStatus({
formStatus: 'not-submitted',
error: longOperationResult.operationErrorMessage
});
} else {
// setting form status to submitted
event.setFormStatus({
formStatus: 'submitted'
});
}
});
addEventListener('notification-form-submitted', async (event) => {
// preventing the default submit behaviour
event.preventDefault();
// setting the form status to processing
event.setFormStatus({
formStatus: 'Processing'
});
const longOperationResult = await ...();
if (longOperationResult.hasError) {
// setting error if long-running operation has failed.
event.setFormStatus({
formStatus: 'not-submitted',
error: longOperationResult.operationErrorMessage
});
} else {
// setting form status to submitted
event.setFormStatus({
formStatus: 'submitted'
});
}
});
Allows to set the status of the form. The form status reflects the state of the submit button which includes its text.
Submit button text for different statuses is defined using formOptions
property for a submit button when creating a notification.
Generated using TypeDoc
Event fired whenever submit button is clicked on a notification form.
"notification-form-submitted"