Changeset 2306


Ignore:
Timestamp:
Sep 2, 2013, 4:24:50 PM (6 years ago)
Author:
matthijs
Message:

plugin-debug: Make sure refreshing works as expected

Some browsers have this feature where they remember form values through
a refresh, overriding whatever the server sends in the refreshed page.
In this case, this could cause old data to be shown, or even make it
impossible to undo a filter.

By setting the autocomplete="off" html5 attribute, browsers will refrain
form automatically changing the content of the textara and just show
whatever the server sends.

The filter input field does not get this autocomplete property, since it
is useful to keep the filter string after a refresh if the browser
supports this. To actually make this work, we run the filter function
once after loading the page.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/luci/applications/luci-debug/luasrc/view/fon_debug/log.htm

    r2305 r2306  
    55
    66<p>Show only log lines containing: <input type="text" id="log_filter" onkeypress="filter_log(this)"></input></p>
    7 <textarea readonly id="log" wrap="off" style="width: 100%; height: 400px; margin-bottom: 20px;">
     7<textarea autocomplete="off" readonly id="log" wrap="off" style="width: 100%; height: 400px; margin-bottom: 20px;">
    88<%= log:gsub("&", "&amp;"):gsub("<", "&lt;"):gsub(">", "&gt;") %>
    99</textarea>
     
    2020    document.getElementById("log").value = text;
    2121  }
     22  // Filter right away, in case the browser remembered the log_filter
     23  // value through a refresh
     24  filter_log(document.getElementById("log_filter"));
    2225</script>
Note: See TracChangeset for help on using the changeset viewer.