We have moved to Github. Please open tickets there.

#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

Of course a function like

elgg_view_yes_no($value, $reverse)

is also an option (maybe a better one)

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:

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.

Note: See TracTickets for help on using tickets.