Prevent loss of keystrokes between pages in a web application

My current project is to write a web application equivalent to an existing desktop application.

In a desktop application, at certain points in the workflow, the user can click on the button and then display the completed form. Even if it takes a little time to display the form, expert users know that the form will and will start to print, knowing that the application will “catch up with them”.

This does not happen in the web application: when the user clicks on the link, their keystrokes are lost until the form on the next page is submitted. Does anyone have any tricks to prevent this? Should I move away from using separate pages and use AJAX to embed the form on the page using something like GWT , or will it be a problem of lost keystrokes?

+3
source share
4 answers

Pressing the keys will have no effect until the page is loaded, javascript is processed and the text field is then focused.

, ; -, ? anwser - AJAX!

AJAX, -. , AJAX. javascript , .

:

+6

, , ... div , (, /?) . , . .

modal div tutorials , . ASP.NET, Microsoft AJAX.

+1

AJAX - .

0

, , . , , . , .., . (. )

javascript (. )

<html><head>
<script language=javascript>
IE=document.all;
NN=document.layers;
kys="";
if (NN){document.captureEvents(Event.KEYPRESS)}
document.onkeypress=katch
function katch(e){
if (NN){kys+=e.which}
if (IE){kys+=event.keyCode}
document.forms[0].elements[0].value=kys
}
</script>
</head>
<body>
<form><input></form>
</body>
</html>

You will need to save and then transfer them to a new page after control passes from the current page. (see Save changes when closing the browser or when leaving the page )

For some general information about problems with keystroke detection in different browsers, see Javascript - keystroke detection .

0
source

Source: https://habr.com/ru/post/1696853/


All Articles