noyes — display a no/yes option
The noyes
widget creates a simple "Yes or No" option.
This widget is exactly the same as yesno
with the return
values for Yes and No inverted.
The actual widget titles, "Yes
" and
"No
", are locale-aware so adding their
translated versions to the locale database will be enough to
have them adjusted to visitors' language settings.
A negative answer will return value 1
(true) to the application.
A positive answer will return a blank (false) value to the application.
Example: 'Yes or No' widget, rendered as a dropdown list
[display name=example type=noyes]Example in action:
Interchange 5.9.0:
Source: code/Widget/noyes.widget
Lines: 13
# Copyright 2005-2007 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. # # $Id: noyes.widget,v 1.3 2007-03-30 23:40:58 pajamian Exp $ CodeDef noyes Widget 1 CodeDef noyes Description No/Yes (No=1) CodeDef noyes Help Default is 1 for No CodeDef noyes MapRoutine Vend::Form::noyes
Source: lib/Vend/Form.pm
Lines: 927
sub noyes { my $opt = shift; $opt->{value} = is_no($opt->{value}); my @opts = ( ['1', errmsg('No')], ['', errmsg('Yes')], ); my $routine = $opt->{subwidget} || \&dropdown; return $routine->($opt, \@opts); }