I have a submit button like as follows.
<input type="submit"
name="btnDelete"
id="btnDelete"
value="Delete"
onclick="this.form.action='${pageContext.request.contextPath}/Country/DeleteMany'"/>
I causes the form action to change, when it is pressed.
I however, need to invoke another function before this action is changed. This another function returns a boolean value based on a confirm dialog of JavaScript.
I have tried the following.
onclick="return confirmDeleteMuliple(); this.form.action='${pageContext.request.contextPath}/Country/DeleteMany'"
The action however, did not change on submit (when confirmDeleteMuliple() returns true).
I have tried placing the code that changes the action in a separate JavaScript function like as follows.
function deleteManyAction()
{
document.dataForm.action='${pageContext.request.contextPath}/Country/DeleteMany';
}
And the onclick attribute is changed as follows.
onclick="return confirmDeleteMuliple();deleteManyAction();"
The deleteManyAction() function however, never invoked. It works only when the function confirmDeleteMuliple() is removed from onclick.
How to invoke these two functions in the defined sequence?
The expression ${pageContext.request.contextPath} evaluates to a context path of the application on load time like /Example (when this file (JSP) is parsed).
onsubmitevent of javascript..confirmDeleteMuliple()returns true. Otherwise, nothing should happen).confirmDeleteMultiplefunction when it is returning true.returnstatement does?