ynzero — display a yes/no option


The ynzero widget creates a simple "Yes or No" option.

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 0 (false) to the application.
A positive answer will return value 1 (true) to the application.


Example: 'Yes or No' widget, rendered as a dropdown list

[display name=example type=ynzero]
Example in action:

Example: 'Yes or No' widget, rendered as a "radio" button

[display name=example type=ynzero variant=radio]
Example in action:
               No Yes


The widget is created by Interchange's Vend::Form::yesno function. Passing attribute type="yesno radio" to it is equivalent to passing attributes type=yesno variant=radio. However, only method type="yesno radio" is available if the widget is invoked through the [widget] tag and ITL.


ynzero is available in Interchange versions:

4.6.0-5.9.0 (git-head)


Interchange 5.9.0:

Source: code/Widget/ynzero.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: ynzero.widget,v 1.1 2007-12-02 15:45:04 mheins Exp $

CodeDef ynzero Widget 1
CodeDef ynzero attrDefault no_value 0
CodeDef ynzero Description Yes/No (Yes=1, No=0 -- default=No)
CodeDef ynzero MapRoutine Vend::Form::yesno

Source: lib/Vend/
Lines: 909

sub yesno {
my $opt = shift;
$opt->{value} = is_yes($opt->{value});
my $yes = defined $opt->{yes_value} ? $opt->{yes_value} : 1;
my $no  = defined $opt->{no_value} ? $opt->{no_value} : '';
my $yes_title = defined $opt->{yes_title} ? $opt->{yes_title} : errmsg('Yes');
my $no_title  = defined $opt->{no_title} ? $opt->{no_title} : errmsg('No');
my @opts;
my $routine = $opt->{subwidget} || \&dropdown;
if($opt->{variant} eq 'checkbox') {
  @opts = [$yes, ' '];
else {
  @opts = (
        [$no, $no_title],
        [$yes, $yes_title],
return $routine->($opt, \@opts);


Interchange Development Group



DocBook! Interchange!