Commit b973fa3a authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 505015: Selections are not persistent across submissions - Patch by…

Bug 505015: Selections are not persistent across submissions - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=ghendricks a=LpSolit
parent 908feaf0
...@@ -50,6 +50,7 @@ function subcatSelected() { ...@@ -50,6 +50,7 @@ function subcatSelected() {
i++; i++;
} }
namewidget.disabled = false;
namewidget.options[0].selected = true; namewidget.options[0].selected = true;
checkNewState(); checkNewState();
...@@ -98,23 +99,16 @@ function subcatSelected() { ...@@ -98,23 +99,16 @@ function subcatSelected() {
<td> <td>
<noscript> <noscript>
<input type="submit" name="action-assemble" value="Update --&gt;" <input type="submit" name="action-assemble" value="Update --&gt;"
id="action-assemble"> id="action-assemble2">
</noscript> </noscript>
</td> </td>
<td align="left"> [% PROCESS series_select sel = { name => 'name',
<select name="name" id="name" style="width: 15em" size => 5,
size="5" multiple="multiple" multiple => 1,
[%+ "disabled=\"disabled\"" UNLESS name.keys.size %]> # We want to use the series ID as value,
[% FOREACH x = name.keys.sort %] # not its name.
<option value="[% name.$x FILTER html %]"> value_in_hash => 1 } %]
[% x FILTER html %]</option>
[% END %]
[% UNLESS name.keys.size %]
<option value="" disabled="disabled"></option>
[% END %]
</select>
</td>
<td align="center" valign="middle"> <td align="center" valign="middle">
<input type="submit" name="action-add" value="Add To List" <input type="submit" name="action-add" value="Add To List"
...@@ -124,14 +118,6 @@ function subcatSelected() { ...@@ -124,14 +118,6 @@ function subcatSelected() {
[% END %] [% END %]
</table> </table>
<script type="text/javascript">
document.chartform.category[0].selected = true;
document.chartform.subcategory.disabled = '';
document.chartform.name.disabled = '';
catSelected();
subcatSelected();
</script>
<h3>List Of Data Sets To Plot</h3> <h3>List Of Data Sets To Plot</h3>
[% IF chart.lines.size > 0 %] [% IF chart.lines.size > 0 %]
......
...@@ -48,7 +48,6 @@ var series = { ...@@ -48,7 +48,6 @@ var series = {
[% END %] [% END %]
}; };
[%# Should attempt to preserve selection across invocations @@@ %]
[%# This function takes necessary action on selection of a category %] [%# This function takes necessary action on selection of a category %]
function catSelected() { function catSelected() {
var cat = document.chartform.category.value; var cat = document.chartform.category.value;
...@@ -67,7 +66,8 @@ function catSelected() { ...@@ -67,7 +66,8 @@ function catSelected() {
[% IF newtext %] [% IF newtext %]
subcatwidget.options[i] = new Option("[% newtext FILTER js %]", ""); subcatwidget.options[i] = new Option("[% newtext FILTER js %]", "");
[% END %] [% END %]
subcatwidget.disabled = false;
subcatwidget.options[0].selected = true; subcatwidget.options[0].selected = true;
if (document.chartform.action[1]) { if (document.chartform.action[1]) {
...@@ -100,11 +100,13 @@ function checkNewState() { ...@@ -100,11 +100,13 @@ function checkNewState() {
<td align="left"> <td align="left">
<select name="[% sel.name %]" id="[% sel.name %]" <select name="[% sel.name %]" id="[% sel.name %]"
size="[% sel.size %]" style="width: 15em" size="[% sel.size %]" style="width: 15em"
[%+ 'multiple="multiple"' IF sel.multiple %]
[%+ "disabled=\"disabled\"" UNLESS ${sel.name}.keys.size || newtext %] [%+ "disabled=\"disabled\"" UNLESS ${sel.name}.keys.size || newtext %]
[%+ "onchange=\"$sel.onchange\"" IF sel.onchange %]> [%+ "onchange=\"$sel.onchange\"" IF sel.onchange %]>
[% FOREACH x = ${sel.name}.keys.sort %] [% FOREACH x = ${sel.name}.keys.sort %]
<option value="[% x FILTER html %]" [% value = sel.value_in_hash ? ${sel.name}.$x : x %]
[% " selected" IF default.${sel.name} == x %]> <option value="[% value FILTER html %]"
[% " selected" IF default.${sel.name} == value %]>
[% x FILTER html %]</option> [% x FILTER html %]</option>
[% END %] [% END %]
[% IF newtext %] [% IF newtext %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment