From 1365b07390c2db42cd2f16082ce1751688627dc0 Mon Sep 17 00:00:00 2001 From: Andrew Robert Nicols Date: Fri, 30 Nov 2012 09:54:37 +0000 Subject: [PATCH] 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. --- lib/outputrenderers.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 775e1f65261..bc89a754f8d 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -1425,9 +1425,15 @@ class core_renderer extends renderer_base { $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) {