Hello,
My team and I are working on a project for work that uses an ipod and scanner chassis. We are writing the web application in ASP.NET/VB.NET
and are encountering a bit of difficulty attempting to intercept a javascript submit that is coming from the scanner. In order for the scanner to work we require a 3rd party software called WebHub to be installed on the device which I have received documentation from the developer and have determined that the form is being submitted through javascript. Unfortunately this causes us grief as we are relying on a button click for the form to be submitted, that way it runs the correct subs in the code behind. To compensate for this we are having to force a button click in the code of the page load in order to get the scanner to work correctly. This is creating other issues where we need to come up with work arounds to prevent the page from submitting twice from a desktop browser vs the scanner as the user clicks the button on desktop so it fires the button event and then also fires the button event in the page load.
I am a real beginner at javascript and am having a very difficult and frustrating time with this problem as every single thing I try seems to either not work at all or not as intended. I believe I have narrowed down the necessary code to accomplish what I’m looking for to the following (I apologize if this is hard to look at):
document.getElementById("form1").addEventListener("submit", interceptScan(event));
function interceptScan(e) {
e.preventDefault();
document.getElementById("btnSearch").click();
};
I put an alert in the function and it appears this code does not execute at all. This code is placed below my closing form tag.
Any help with this issue is beyond greatly appreciated.