Skip to content

Commit

Permalink
Remove warning messages at top/bottom of ordered select widget in fav…
Browse files Browse the repository at this point in the history
…or of silently refusing to do silly things.
  • Loading branch information
esteele committed Sep 19, 2015
1 parent f3b79c6 commit df27622
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ CHANGES
3.2.7 (unreleased)
------------------

- Remove "cannot move farther up/down" messages
in ordered select widget.
[esteele]

- Updated Traditional Chinese translation.
[l34marr]

Expand Down
8 changes: 2 additions & 6 deletions src/z3c/form/browser/orderedselect_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ function moveUp(name)

if (toSel.selectedIndex == -1)
selectionError();
else if (toSel.options[0].selected)
alert("Cannot move further up!");
else for (var i = 0; i < toSel.length; i++)
else for (var i = 1; i < toSel.length; i++)
if (toSel.options[i].selected)
{
swapFields(toSel.options[i-1], toSel.options[i]);
Expand All @@ -83,10 +81,8 @@ function moveDown(name)

if (toSel.selectedIndex == -1) {
selectionError();
} else if (toSel.options[toSel.length-1].selected) {
alert("Cannot move further down!");
} else {
for (var i = toSel.length-1; i >= 0; i--) {
for (var i = toSel.length-2; i >= 0; i--) {
if (toSel.options[i].selected) {
swapFields(toSel.options[i+1], toSel.options[i]);
}
Expand Down

0 comments on commit df27622

Please sign in to comment.