JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!



Auto Submit HTML Form after 5 minutes of inactivity


L

keyboard_arrow_up
0
keyboard_arrow_down


First Post Mark as Spam leoinslc
Posts: 1 - Registered: 2015-12-18 01:52:30

Does anyone know how I can get an html form to automatically save or submit after 5 minutes of inactivity? The action after submit is clicked on my forms just saves the form and returns to the top of the form. Much thanks...!




R

keyboard_arrow_up
0
keyboard_arrow_down


Reply #1 Mark as Spam Rasmus12
Posts: 1 - Registered: 2015-12-19 03:02:14

Welcome to DEVPPL! :)

If you use jQuery you can make it to auto post after 5 minutes since the page is loaded with something like the code below. The number in the javascript code is milliseconds, 5 min = 60x5 = 300 seconds = 300000 millisecons.


HTML:






JavaScript/jQuery:
setTimeout( function(){
$("#myForm").submit();
} , 300000 );



Although you asked for when inactive for 5 minutes, and in that case, we can set the timeout to start count, and reset every time user types in the text input field. This should work.
JavaScript/jQuery:
$("#myTextInput").on('keypress', function() {
setTimeout( function(){
$("#myForm").submit();
} , 300000 );
});





A

keyboard_arrow_up
0
keyboard_arrow_down


Reply #5 Mark as Spam Adobe
Posts: 2 - Registered: 2016-01-20 18:41:24

What is the use of auto submit html form after five months of inactivity




A

keyboard_arrow_up
0
keyboard_arrow_down


Reply #6 Mark as Spam Adobe
Posts: 2 - Registered: 2016-01-20 18:41:24

What is the use of auto submit html form after five months of inactivity






JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!




MENU
Advertising