Skip to content

Commit

Permalink
Avoid duplicate values of HTML id attributes (bug #3614245)
Browse files Browse the repository at this point in the history
Unsupports <label> in IE6.
  • Loading branch information
vrana committed Jun 3, 2013
1 parent e04be3a commit 26ad18b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion adminer/include/adminer.inc.php
Expand Up @@ -287,7 +287,7 @@ function selectOrderPrint($order, $columns, $indexes) {
}
}
echo "<div><select name='order[$i]' onchange='selectAddRow(this);'><option>" . optionlist($columns, null, true) . "</select>";
echo "<label><input type='checkbox' name='desc[$i]' value='1'>" . lang('descending') . "</label></div>\n"; // not checkbox() to allow selectAddRow()
echo checkbox("desc[$i]", 1, false, lang('descending')) . "</div>\n";
echo "</div></fieldset>\n";
}

Expand Down
6 changes: 2 additions & 4 deletions adminer/include/functions.inc.php
Expand Up @@ -99,14 +99,12 @@ function nl_br($string) {
* @return string
*/
function checkbox($name, $value, $checked, $label = "", $onclick = "", $class = "") {
static $id = 0;
$id++;
$return = "<input type='checkbox' name='$name' value='" . h($value) . "'"
. ($checked ? " checked" : "")
. ($onclick ? ' onclick="' . h($onclick) . '"' : '')
. " id='checkbox-$id'>"
. ">"
;
return ($label != "" || $class ? "<label for='checkbox-$id'" . ($class ? " class='$class'" : "") . ">$return" . h($label) . "</label>" : $return);
return ($label != "" || $class ? "<label" . ($class ? " class='$class'" : "") . ">$return" . h($label) . "</label>" : $return);
}

/** Generate list of HTML options
Expand Down
2 changes: 1 addition & 1 deletion adminer/static/editing.js
Expand Up @@ -295,7 +295,7 @@ function editingAddRow(button, focus) {
var tags = row.getElementsByTagName('select');
var tags2 = row2.getElementsByTagName('select');
for (var i=0; i < tags.length; i++) {
tags2[i].name = tags[i].name.replace(/([0-9.]+)/, x);
tags2[i].name = tags[i].name.replace(/[0-9.]+/, x);
tags2[i].selectedIndex = tags[i].selectedIndex;
}
tags = row.getElementsByTagName('input');
Expand Down
1 change: 1 addition & 0 deletions changes.txt
Expand Up @@ -2,6 +2,7 @@ Adminer 3.7.1-dev:
Increase click target for checkboxes
Use shadow for highlighting default button
Don't use LIMIT 1 if inline updating unique row
Don't check previous checkbox on added column in create table (bug #3614245)
Order table list by name
PostgreSQL: Fix detecting oid column in PDO
PostgreSQL: Handle timestamp types (bug #3614086)
Expand Down

0 comments on commit 26ad18b

Please sign in to comment.