Hi all,
i have a
JSP where i have some buttons and specially i have submit button of type button when the user presses this submit button very rarely in production it is submitting twice but i tried to recreate the problem in my
test server but unable to create,i dont why know it is happening only in production and it is rare the following is the way how we handled to disable the buttons when it is clicked
<span class="button-blue HideInPrint"><input type="button" name="sButton" value="Submit" onclick"javascript:continueAction('submit');" <%=buttonStatus%> /></span>
<input type="hidden" name="submitButton" value="" />
function continueAction(typeOfAction)
{
disableButtons();
//Populate the appropriate hidden field that will be passed to the
servlet,
//depending on the type of action performed on the page
if (typeOfAction == "submit") {
document.billSumm.submitButton.value="Submitted";
} else if (typeOfAction == "save") {
document.billSumm.saveAsDraft2.value="Saved";
}
else if (typeOfAction == "cancel") {
document.billSumm.cancel.value="Cancelled";
}
//Invoke submission
document.billSumm.submit();
}
function disableButtons()
{
if (document.all || document.getElementById) {
for (i = 0; i < document.billSumm.length; i++) {
var tempobj = document.billSumm.elements[i];
if (tempobj.type.toLowerCase() == "button")
tempobj.disabled = true;
}
}
}
please advice when does this problem occur and how over come it.