I have a service that clients use by pasting a bit of JavaScript into their page. I've been tasked with executing a specific function if, and only if, the page in question has one or more forms on it *and* the user submits one of those forms.
There are of course many variations in how forms are implemented, but for now I'm only concerned with traditional forms -- ones that have a <form> tag and are submitted by a type="submit" control or an object that uses "submit()."
My idea is to traverse the DOM and identify any/all form submit controls, and then intercept the submission to do my own thing.
My question is this: if I intercept form submission, and I return true after executing my function, will the original code run as intended? For instance, if the page was using JavaScript form validation, will that validation still run after I've done my own thing?
Or is there a better way to accomplish my goal?
If this is confusing or unclear, I'll try to reword it.