Revision 49741
Added by Sofia Baltzi over 6 years ago
register.jsp | ||
---|---|---|
221 | 221 |
$(".msg_pass_conf_error").fadeOut(); |
222 | 222 |
}); |
223 | 223 |
|
224 |
|
|
225 |
// Run on page load |
|
226 |
window.onload = function() { |
|
227 |
|
|
228 |
// // If sessionStorage is storing default values (ex. name), exit the function and do not restore data |
|
229 |
// if (sessionStorage.getItem('name') == "name") { |
|
230 |
// return; |
|
231 |
// } |
|
232 |
|
|
233 |
// If values are not blank, restore them to the fields |
|
234 |
|
|
235 |
var first_name = sessionStorage.getItem('first_name'); |
|
236 |
if (first_name !== null) $('#first_name').val(first_name); |
|
237 |
|
|
238 |
var last_name = sessionStorage.getItem('last_name'); |
|
239 |
if (last_name !== null) $('#last_name').val(last_name); |
|
240 |
|
|
241 |
var organization = sessionStorage.getItem('organization'); |
|
242 |
if (organization !== null) $('#organization').val(organization); |
|
243 |
|
|
244 |
var username = sessionStorage.getItem('username'); |
|
245 |
if (username !== null) $('#username').val(username); |
|
246 |
|
|
247 |
var email = sessionStorage.getItem('email'); |
|
248 |
if (email !== null) $('#email').val(email); |
|
249 |
|
|
250 |
var email_conf= sessionStorage.getItem('email_conf'); |
|
251 |
if (email_conf!== null) $('#email_conf').val(email_conf); |
|
252 |
|
|
253 |
|
|
254 |
} |
|
255 |
|
|
256 |
// Before refreshing the page, save the form data to sessionStorage |
|
257 |
window.onbeforeunload = function() { |
|
258 |
sessionStorage.setItem("first_name", $('#first_name').val()); |
|
259 |
sessionStorage.setItem("last_name", $('#last_name').val()); |
|
260 |
sessionStorage.setItem("organization", $('#organization').val()); |
|
261 |
sessionStorage.setItem("username", $('#username').val()); |
|
262 |
sessionStorage.setItem("email", $('#email').val()); |
|
263 |
sessionStorage.setItem("email_conf", $('#email_conf').val()); |
|
264 |
} |
|
265 |
|
|
266 |
|
|
267 |
|
|
224 | 268 |
</script> |
225 | 269 |
</div> |
226 | 270 |
</ul> |
Also available in: Unified diff
Add javascript code to keep input after redirect to the same jsp page