FSM (Finite state machine) modelling of a web page's states using jQuery -
I'm interested in how the behavior described below can be applied, using jQuery.
Technical overview:
Technically, behavior is ideally designed by the state machine:
One page Loads and initial status (State A). There is no restriction on the user in one page at one place in the state, on one user page, irrespective of who can do anything. Once in Page B (accessed by clicking on a specific button / link etc.), the user will have to complete a special step to complete the page (usually fill out a form and submit it), other words in the initial state In the form correctly rendering the form, the page returns the initial status (state A)
, while in state B, any attempt to move the user away from the page or the current one Click on the other link, page etc. will pop up a message box (or JQuery message box) and ask the user to confirm (yes, cancel) if they want to get away from the current work.
Practice:
A page is displayed, which presents a button to click on the user to fill in some required information. The user ignored the button and chose the option to move with the site pressed. However, once the user clicks on the button and begins to enter the information, if they (deliberately or deliberately) wanted to get away from the work (i.e. to do so that the current page will be refreshed or reloaded), then A message box should be popup and the user should ask to confirm whether they really want to do. A good example of this kind of behavior is actually found on this website when you click on the 'Ask a Question' button.
I would like to know how to implement such behavior,
See the You can use it with jQuery: This will set window. P>
var warning = false; Window.onbeforeunload = function (e) {Return alert; }; $ ('Input, Texter, Selection'). Change (function () {warning = true;});
warning
to true whenever the user changes the selected form field. When the page is "unloaded", the window triggers the onbeforeunload
event and displays a warning if the function returns the correct ( warning
variable).
Comments
Post a Comment