I created a web part and generated a form using Javascript. My objective is to handle the submit event. For this I added an eventListener :

window.addEventListener("submit", handleFormSubmit);

When I submit i shoud trig the function handleFormSubmit...

const handleFormSubmit = event => {
    const form = document.getElementById('requestForm');


    const data = formToJSON(form.elements);

    if (listLoaded) {
        let btn = document.getElementById('btnOk');
        btn.disabled = true;
        btn.innerText  = handleMessages("ongoingStatus");

        let msg = document.getElementById('showMessage');
        msg.innerHTML = handleMessages("ongoing");


I would like to understand why the click on the button it's not getting in this function. The same code displayed in a basic HTML page works perfectly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.