Skip to content
Snippets Groups Projects
Commit 8367d662 authored by Kjartan Mannes's avatar Kjartan Mannes
Browse files

Changes

- Modifed form_select() to accept an optional 6th parameter which is appeneded
  to the select tag. $value can now also be an array. This allows for multiple
  selects:
  form_select($header, $name, $values, $options, $help, "multiple=\"true\" size=\"10\"");
- Updated account.module to use the extended form_select() functionality.
parent 542b60a1
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -179,10 +179,10 @@ function form_textarea($title, $name, $value, $cols, $rows, $description = 0) { ...@@ -179,10 +179,10 @@ function form_textarea($title, $name, $value, $cols, $rows, $description = 0) {
return form_item($title, "<textarea wrap=\"virtual\" cols=\"$cols\" rows=\"$rows\" name=\"edit[$name]\">". check_form($value) ."</textarea>", $description); return form_item($title, "<textarea wrap=\"virtual\" cols=\"$cols\" rows=\"$rows\" name=\"edit[$name]\">". check_form($value) ."</textarea>", $description);
} }
function form_select($title, $name, $value, $options, $description = 0) { function form_select($title, $name, $value, $options, $description = 0, $extra = 0) {
if (count($options) > 0) { if (count($options) > 0) {
foreach ($options as $key=>$choice) $select .= "<option value=\"$key\"". ($key == $value ? " selected" : "") .">". check_form($choice) ."</option>"; foreach ($options as $key=>$choice) $select .= "<option value=\"$key\"". (is_array($value) ? (in_array($key, $value) ? " selected" : "") : ($key == $value ? " selected" : "")) .">". check_form($choice) ."</option>";
return form_item($title, "<select name=\"edit[$name]\">$select</select>", $description); return form_item($title, "<select name=\"edit[$name]\"". ($extra ? " $extra" : "") .">$select</select>", $description);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment