1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-07 23:27:17 +02:00

Move inline event handlers to <script>

This commit is contained in:
Jakub Vrana
2018-01-12 12:42:30 +01:00
parent 767fc0e47e
commit 3b0e1cf289
4 changed files with 15 additions and 9 deletions

View File

@@ -176,13 +176,15 @@ function html_select($name, $options, $value = "", $onchange = true, $labelled_b
* @param array
* @param string
* @param string
* @param string
* @return string
*/
function select_input($attrs, $options, $value = "", $placeholder = "") {
return ($options
? "<select$attrs><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>"
: "<input$attrs size='10' value='" . h($value) . "' placeholder='$placeholder'>"
);
function select_input($attrs, $options, $value = "", $onchange = "", $placeholder = "") {
$tag = ($options ? "select" : "input");
return "<$tag$attrs" . ($options
? "><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>"
: " size='10' value='" . h($value) . "' placeholder='$placeholder'>"
) . ($onchange ? "<script>qsl('$tag').onchange = $onchange;</script>" : "");
}
/** Get onclick confirmation