How can I save values from form to sessionStorage when the form is submitted?
Something like this?
<form id="myForm" method="get" action="lista.html" rel="external" data-ajax="false" >
<label for="autonumero"> Anna autonumero </label>
<input type='tel' name="autonumero" data-corners="false"/>
<input type="submit" onclick="saveData()" value="OK" data-theme="a" data-corners="false" />
<script> function savedata()
{ var input = document.getElementById("autonumero");
sessionStorage.setItem("autonumero", input.value);
</script>
</form>
The form needs to be submitted also so just saving the values isn't enough
Try:
<input type="submit" onclick="return saveData();" value="OK" data-theme="a" data-corners="false" />
<script type="text/javascript">
function savedata() {
var input = document.getElementById("autonumero");
sessionStorage.setItem("autonumero", input.value);
return true;
}
</script>