Permalink
Browse files

MDL-36934 Only set the autosubmit class on selects when required

The url_select class can optionally show a button (much like the non-JS
fallback). In this case, the autosubmit nature of the form shouldn't be
enforced and it should only submit on the button.
  • Loading branch information...
1 parent 5eadb30 commit 1365b07390c2db42cd2f16082ce1751688627dc0 @andrewnicols andrewnicols committed with sammarshallou Nov 30, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/outputrenderers.php
View
@@ -1425,9 +1425,15 @@ protected function render_url_select(url_select $select) {
$output .= html_writer::label($select->label, $select->attributes['id'], false, $select->labelattributes);
}
- $select->attributes['class'] = 'autosubmit';
+ $classes = array();
+ if (!$select->showbutton) {
+ $classes[] = 'autosubmit';
+ }
if ($select->class) {
- $select->attributes['class'] .= ' ' . $select->class;
+ $classes[] = $select->class;
+ }
+ if (count($classes)) {
+ $select->attributes['class'] = implode(' ', $classes);
}
if ($select->helpicon instanceof help_icon) {

0 comments on commit 1365b07

Please sign in to comment.