JSP MI: The Double Click Issue
Have you heard of the "double click" issue? This happens when a user clicks a hyperlink twice (= double click) on the PDA. Or - and this is even worse – the user clicks two or more links on the UI. Something rather easy to do with the performance of today’s PDAs. What will happen? Quite frankly, anything. In the worst case you will corrupt your client‘s database, which means you will have to reinstall the MI client.
To avoid this, change the code of your user interface. How? Parse all links with Javascript.
<a href="#" onClick="goTo('/MAM/Controller?id=42');">link</a>
Instead of going directly to a page, you execute a JavaScript function that can look like this:
var linkActivatedFlag = false;
function goTo(url) {
if (linkActivatedFlag == false) {
document.location.href = url
linkActivatedFlag = true;
}
}
Do the same with your forms. If the user clicks on the submit button, the form needs to be submitted and the button needs to be deactivated:
<form name="myMiApplicationForm">
<input type="button" name="myMiButton" value="Click to Submit"
onClick="doSubmit();">
<script language="JavaScript">
function doSubmit()
{
document.myMiApplicationForm.myButton.disable = true;
document.myMiApplicationForm.submit();
}
</script>
</form>
Adapt all JSPs/HTML pages of your MI application to this pattern. Disadvantages of this approach:
Javascript is browser dependent. There might be browser versions where your Javascript implementation does not work.
Illegal navigation like returning to an outdated predecessor page by pressing the browser's return button is not covered.