Unable to use joget.submitForm(). It is throwing error.

Confluence User - 09 Feb, 2023

I want to stop the navigation of a form after form submit. For this I am trying to write a script in customHTML.

So for this I am trying to do the form submission manually by using the following code : 


<script type="text/javascript">
            document.addEventListener("DOMContentLoaded", function(event) {
                var submitButton = document.querySelector("[type='submit']");
                if (submitButton) {
                    submitButton.addEventListener("click", function(event) {
                        event.preventDefault();
                        // Add custom logic here
                        // ...
                        // Submit the form manually when ready
                        joget.submitForm();
                        // Prevent form navigation
                        event.stopPropagation();
                    });
                }
            });
        </script>


This is giving me error that joget is not defined. Also If I try to include joget.js and joget.min.js file (which should be automatically included) by API, I am getting error as it is unable to find these two files :

/jw/web/js/joget.js


Please help. Thanks in Advance


forms

1


10 Feb, 2023
confluenceUser
confluenceUser

Hi, the JavaScript code doesn't appear to be correct. The error is correct when it says "joget is not defined", since there is no "joget" defined in the code, and I am not aware of any joget.js or joget.min.js file. You could try searching for proper JavaScript examples, for example https://stackoverflow.com/questions/71090513/how-to-stop-form-submission.

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print