I have encountered an issue with my forms that has me stumped. Despite searching online for help, I can't seem to figure out why my implementation is not working as intended.
The concept is straightforward. I've embedded a form within a JSP page. The form includes an 'onsubmit' property that is supposed to trigger the opening of a different JSP file along with some parameters. Additionally, there are buttons inside the form, one of which invokes a JavaScript function responsible for submitting the form under specific conditions.
Below is the relevant code snippet: JSP:
...
<form id='testForm' onsubmit="window.open('another.jsp')">
<input type="button" onclick="callJsFunction()" />
..
</form>
JavaScript:
function callJsFunction() {
if (launchNow == 1) {
var form = document.getElementById("testForm");
form.submit();
}
}
Adding target="_blank" to the form definition opens a new window, but not the desired JSP file. My end goal is for the form to execute a servlet action (using the action attribute) and then display the new JSP file. Any suggestions or insights would be greatly appreciated!
Thank you!