[1] Sebelum form dikirum (submit), check dulu dengan fungsi javascript
checkSubmit()
<form action="myAction.do" method="post" onsubmit="return checkSubmit();">Kode javascript :
<script language="javascript">
var checkSubmitFlg = false;
function checkSubmit() {
if (checkSubmitFlg == true) {
return false;
}
checkSubmitFlg = true;
return true;
}
document.ondblclick = function docondblclick() {
window.event.returnValue = false;
}
document.onclick = function doconclick() {
if (checkSubmitFlg) {
window.event.returnValue = false;
}
}
</script>
[2] Cara lain adalah dengan menggunakan bantuan tag input tipe image :
<form action="myAction.do" method="post"
onsubmit="getElById('submitInput').disabled = true; return true;">
<input type="image" id="submitInput" src="images/buttonOK.gif" border="0" />
</form>
No comments:
Post a Comment