Submit form and save values to sessionStorage

How can I save values from form to sessionStorage when the form is submitted?

Something like this?

  • Delete empty values from form's params before submitting it
  • Enter key to submit Ajax form
  • Is there any danger to using input fields outside/without forms in HTML/Javascript pages?
  • How to format input Date using Angular 1.3 and further
  • How can i build a group with three inputs in form validation?
  • Implementing placeholder=“” for opera through jquery
  •         <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

  • Checking / Unckecking Checkbox based on Input Content
  • Relative form action resolves to absolute URL?
  • Bootstrap form validation validates all the fields inside same form group
  • jquery validate plugin on dynamic form inputs not working
  • sweet alert continue submitting form on confirm
  • Javascript to Select Multiple options
  • 2 Solutions collect form web for “Submit form and save values to sessionStorage”

    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> 
    

    try set input id id=”autonumero”

    <input id="autonumero" type="submit" onclick="return saveData();" value="OK" data-theme="a" data-corners="false" />