How to prevent the form from deleting all data after page refresh

Asked

Viewed 84 times

0

I have an app that has two screens, html register. and html.. In the html register. have a checkbox for the user to accept the terms, can only register if you accept, but is not required to open the Terms screen. But if it opens, there will be at the end of the text two buttons, accept and turn down. Let’s say he said yes, then turn to the page html register. with the checkbox already selected, but loses all the input data he had already filled in.

My question is: how do I not lose this data when it clicks on html. and then redirect to html register.?

  • 2

    there are some possibilities. 1 - You can save the data to a localStorage and then retrieve it. 2 - Open the terms in another tab, use (look for target _Blank) 3 - Open terms in a modal and this way it would not leave the page.

  • 1

    As Lucas said, open the term in a modal.

  • I had already thought of a modal, but I wanted to know if it would have as in other ways.

  • I agree with what his friends said. I think the separation into two pages generates an unnecessary work of having to store the information of the acceptance of the terms. But for information, using only javascript and html, only with localStorage or via URL parameter you could achieve this result. But none of them I would recommend.

  • Or cookie... but not recommend

  • It would not be the case to use sessionStorage?

  • 1

    Possible duplicate of: 1. https://answall.com/q/67219/3635 - 2. https://answall.com/q/424/3635 - 3. https://answall.com/q/116395/3635 - 4. https://answall.com/q/75557/3635 - 5. https://answall.com/q/109935/3635

  • What have you ever tried to do?

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.