I have multiple pages with some input fields. On this page, I have a previous and next button as well as a save (submit) button. When I press the save button, it will save the user input in the database.
However when I press next or previous, I'll get an alert with:'The user input is not saved yet, untill you click the save button.' Pressing OK will go to the next page and cancel will make it stay on this page. This is what I want, however the alert will always pop up whenever I press next or previous even when there's no user input or in case of editting the user input has not changed. So I dont want the alert to popup whenever nothing has changed or nothing is filled in.
This is my javascript function:
function something(evt) {
if ( ! confirm("The user input is not saved yet, untill you click the save button.") ) evt.preventDefault();
}
buttons:
<a onclick="something(event)" href=""> </a>
Also on some pages, there are select boxes as well. These have standard values and the select boxes cant be empty so I can't check on the select boxes. The check should only be on textareas and textfield.
I am not able to figure out how to accomplish this.
How would I get to check if the user input(textarea, textfield) has changed or is not empty in my case?