简体   繁体   中英

How do I keep previous form entry when the user attaches a file

I have a form and it has an attachment button, is it possible to keep the entries they entered when they hit the attach file button and it refreshes? The inputs are all dropdowns, i'm not exactly sure how I should start with this..

You have to catch the entries on the server and when you push the next page back to the client set the entries to be the same.

Or you could use some client side local storage to store the settings before the postback occurs and set them again on next page reload.

There are a few ways you can do this. The simplest way is to simply store the form values in a cookie when the form is submitted using the form.onSubmit event. Essentially, you just read the values from the form into the cookie, and then when the page is refreshed, read them out of the cookie and back into the form. Example here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM