1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Bug 620: Reset form fields to default values on reload

Do not retain changed values in form fields when the user reloads.  Doing
so can be confusing or even cause data-loss when new default values are
specified in the updated document.  For example, when editing an article on
Wikipedia, one loads the edit page for the article, makes and submits
changes, goes back to the edit page to make further modifications, and
reloads to get the new article text.  Before this change, reloading the
edit page would not update the textarea on the page with the new article
source, which can lead one (and has led me) to make changes to the original
version of the article by accident.

This fixes bug 620.
(cherry picked from commit 9e1e94bee0)
This commit is contained in:
Miciah Dashiel Butler Masters 2008-06-10 06:41:34 +00:00 committed by Kalle Olavi Niemitalo
parent c2cf48f9e6
commit 0b99fa70ca

View File

@ -36,6 +36,7 @@
#include "util/error.h" #include "util/error.h"
#include "util/memory.h" #include "util/memory.h"
#include "util/string.h" #include "util/string.h"
#include "viewer/text/form.h"
#include "viewer/text/view.h" #include "viewer/text/view.h"
#include "viewer/text/vs.h" #include "viewer/text/vs.h"
@ -334,6 +335,11 @@ render_document(struct view_state *vs, struct document_view *doc_view,
if (!document) return; if (!document) return;
doc_view->document = document; doc_view->document = document;
if (doc_view->session
&& doc_view->session->reloadlevel > CACHE_MODE_NORMAL)
while (vs->form_info_len)
mem_free_if(vs->form_info[--vs->form_info_len].value);
shrink_memory(0); shrink_memory(0);
render_encoded_document(cached, document); render_encoded_document(cached, document);