Pass value from one page to input of another

0

I have an html page where the user types the email and I carry out the verification. If that email is not in the database, you are a new user and therefore redirect to the registration page.

On the registration page I want the email field to come already with the email typed on the previous page. How do I?

page 1

 <label id=id_email name="email"> </label>

page 2

   <label id=id_email name="email"> </label>

    $( document ).ready(function() {
           $("#id_email").val("[email protected]");
 });
    
asked by anonymous 04.10.2017 / 20:01

2 answers

0

You can use sessionStorage , so the browser will save sessão with your data and you can recover on any page.

Page 1

<input type="text" id="email">
<script>
    let valor = document.getElementById('email').value
    sessionStorage.setItem('email', valor)
</script>

Page 2

<input type="text" id="RecuperaEmail">

<script>
    document.getElementById('RecuperaEmail').value = sessionStorage.email
</script>

Or you can do this with jQuery

Page 1

<input type="text" id="email">
<script>
    var valor = $('#email').val()
    sessionStorage.setItem('email', valor)
</script>

Page 2

<input type="text" id="RecuperaEmail">

<script>
    $('#RecuperaEmail').val(sessionStorage.email)
</script>
    
04.10.2017 / 20:30
0

You could try as follows.

<input type="hidden" name="volposition" value="{{ request.REQUEST.email }}">

Taking into account that you do in the action the post to send to another page.

    
04.10.2017 / 20:24