Opened 17 months ago
Closed 13 months ago
#4230 closed Enhancement (wontfix)
input/yes_no
| Reported by: | coldtrick | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Needs Review |
| Component: | Core | Version: | 1.8.1 |
| Severity: | trivial | Keywords: | |
| Cc: | brett@… | Difficulty: |
Description (last modified by ewinslow)
It would be nice if there was a input/yes_no.
The only feature of the view will be to show an input/dropdown.
the view should be able to use all the input/pulldown option but override the option values with the following. It should also be able to handle a $varsreverse? that will reverse the options, a no / yes
$options_values = array(
"yes" => elgg_echo("option:yes"),
"no" => elgg_echo("option:no")
);
A lot of plugins use this simple pulldown. It will save a bit of code.
Change History (4)
comment:1 Changed 17 months ago by coldtrick
comment:2 Changed 17 months ago by cash
Definite no on the function elgg_view_yes_no(). Why would it get its own function when the other input view do not.
Why drop down menu rather than vertical radio buttons or checkbox?
comment:3 Changed 17 months ago by brettp
There is some precedent for adding helper views like this:
- input/location - http://trac.elgg.org/ticket/3489
- input/securitytoken - https://github.com/Elgg/Elgg/commit/228dedb767db77cd220bc5863c125aec1aa93f06
I absolutely prefer a checkbox for yes / no options. I have a hunch the de facto standard became a dropdown because of Elgg's historically poor support for checkbox inputs.
For reference, here is the code required for a reliable yes / no checkbox.
$checkbox .= elgg_view('input/checkbox', array(
'name' => 'enable_option',
'options' => array(
1 => elgg_echo('option:yes'),
0 => elgg_echo('option:no')
)
));
echo "<label>$checkbox Enable Option</label>";
Adding a new input would take it to:
echo elgg_view('input/yes_no', array(
'name' => 'enable_option',
'text' => 'Enable Option',
'default' => false
));
comment:4 Changed 13 months ago by ewinslow
- Description modified (diff)
- Resolution set to wontfix
- Status changed from new to closed
yes/no is what checkboxes are for. We should not need another input.

Of course a function like
is also an option (maybe a better one)