add error message when supplied id is wrong
This commit is contained in:
parent
790f3fcf6f
commit
9e9d393de8
@ -16,6 +16,10 @@ function interceptForm (formId) {
|
|||||||
* Param formId is the HTML id of the form
|
* Param formId is the HTML id of the form
|
||||||
*/
|
*/
|
||||||
const formElem = document.getElementById(formId)
|
const formElem = document.getElementById(formId)
|
||||||
|
if (!formElem) {
|
||||||
|
console.error('You tried to intercept form id:"' + formId + '" but it was not found.')
|
||||||
|
return
|
||||||
|
}
|
||||||
formElem.onsubmit = async (e) => {
|
formElem.onsubmit = async (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
fetch(formElem.action, {
|
fetch(formElem.action, {
|
||||||
|
Loading…
Reference in New Issue
Block a user