Proposal: "On Off" switch HTML forms Input Object

Paul Robinson (PAUL@tdr.com)
Mon, 01 Jul 1996 10:35:57 EDT


Message-Id: <01.1996Jul01.10h35m57s.PAUL@TDR.COM>
Date: Mon, 01 Jul 1996 10:35:57 EDT
From: Paul Robinson <PAUL@tdr.com>
To: www-html@w3.org
Subject: Proposal: "On Off" switch HTML forms Input Object

The following is being proposed as an Internet Draft.  Please circulate
to anyone who might be interested.  Thank you.


INTERNET DRAFT                                                Paul Robinson
                                       Tansin A. Darcos & Company/TDR, Inc.
                                                               July 1, 1996
                                                  Expires December 31, 1996

              OnOff Switch Input Object Widget for HTML Forms
                  <draft-tdr-robinson-html-onoff-00.txt>

Document Summary

            This document proposes a new type of input object, an "On-Off
        Switch" for HTML forms, and in doing so, proposes new values for
        the TYPE= keyword.


Status of this Memo
  
    This document is an Internet-Draft.  Internet-Drafts are working
    documents of the Internet Engineering Task Force (IETF), its areas,
    and its working groups.  Note that other groups may also distribute
    working documents as Internet-Drafts.
  
    Internet-Drafts are draft documents valid for a maximum of six months
    and may be updated, replaced, or obsoleted by other documents at any
    time.  It is inappropriate to use Internet- Drafts as reference
    material or to cite them other than as ``work in progress.''
  
    To learn the current status of any Internet-Draft, please check the
    "1id-abstracts.txt" listing contained in the Internet-Drafts shadow
    Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
    munnari.oz.au (Pacific Rim), ds.internic.net (US East Cost) or
    ftp.isi.edu (US West Coast).

    Distribution of this document is unlimited.  Please send comments to
    <ONOFF@TDR.COM>.


Table of Contents

    Document Summary                                                   1
    Status of this Memo                                                1
    Table of Contents                                                  1
    Introduction                                                       2
    Description of the Proposed Item                                   2
    Alternatives                                                       3
    Why propose this?                                                  3
    Summary of proposed changes                                        3
    Proposed change to the <INPUT> tag for on-off switch widgets:      3
    Technical Description                                              4
    CGI Return values                                                  4
    Example                                                            4
    Other Possibilities                                                5
    Settings and Conflict Resolution                                   5
    Security Considerations                                            5
    Author's Address                                                   5


                                          1

Robinson                       On-Off Switch                      Page 2

Introduction

	In the options available for Text and Graphical User Interfaces
    and input forms under HTML, there are many different input objects,
    otherwise known as "widgets", which are available including but not
    limited to list, combo, and check boxes, and radio buttons.  One
    particular type of selector is not present: the "on-off" switch.
    This document proposes to rectify the situation by adding this
    feature to HTML forms input.


Description of the Proposed Item

	The idea for an on/off switch came to me from a program I was
    using, in the manner in which it allowed me to select options.  I
    noted that the feature of the on/off switch had not been created
    or implemented for HTML or GUI environments, and it seemed like
    such a useful concept that, in a flash of brilliance, I knew that
    it was something that should be proposed.

	Explaining a commonplace item such as an on-off switch may seem
    silly, but the failure to clarify things which are ambiguous can
    cause problems.

	An On-Off switch is an indicator that shows two states, on and
    off, and has one of them selected.  This type of selector would be
    useful for various applications to show options which are or are
    not selected, where either a selection of one state or the other
    must be done, where there are only two selections, and a default
    value exists.

	One example of the usefulness of this would be where a display
    of the current settings of a particular object were shown, and the
    user, being shown these settings, could change them by selecting
    the opposite setting.  In a Graphical User Interface, the user
    could be shown a slidebar or a light switch, and "clicking" on the
    object would change its setting and provide a visual confirmation.
    In a Text User Interface, the user could be shown the terms "ON OFF"
    with one of them highlighted, and selecting this input item, the
    highlighting would change to the other.

	The advantage to this over using current methods is that the
    item shown would explicitly be a switch rather than a pair of
    selectors.  Also, since the switch display is done locally, a
    graphical image of a switch can be done faster via the local
    user's computer than by downloading an icon of a switch for each
    setting, or, in the case of a text-based interface, the text
    browser can show the words ON OFF (or the local equivalent)
    instead.









Robinson                       On-Off Switch                      Page 3

Alternatives

	Currently, such an indicator could be simulated via use of
    radio buttons or a checkbox to select the "ON" setting.  This,
    however, does not provide the type of functionality that a true
    on/off switch provides, thus I propose that the "on-off switch"
    type widget should be available to explicitly provide this type
    of feature.


Why propose this?

	One reason for adding this type of item is that an on-off
    switch could be displayed more compactly than perhaps two standard
    radio buttons.  An on-off switch could be shown as a slide bar
    with one side or the other showing the slider, or by an image of
    a switch, or other such graphical devices.  Thus the number of
    controls visible in a form or on a screen may be increased as
    opposed to the standard sized radio buttons or checkboxes.

	Also, radio buttons and checkboxes do not look like a toggle
    switch, thus they don't provide the type of visual feedback that
    a switch does.


Summary of proposed changes

	Note that for all of the examples shown in this document, the
    keywords and attributes, as well as the values of keywords, are in
    all upper case, and values that are set by the creator of the page
    are shown in lower case, this is merely for the convenience of the
    reader.  As with all HTML tags, the case of the tag values which
    are used is unimportant, and may be upper, lower, or mixed case,
    so, for example, TYPE=, type=, Type=, and TypE= are all considered
    identical, as are "ONOFF", "OnOff", "ONoff", "onoff", etc.


Proposed change to the <INPUT> tag for on-off switch widgets:
 
         For the TYPE= keyword, a new values is proposed.

         o    TYPE="ONOFF", for an on-off switch widget input device.

         For the VALUE= keyword, the following optional values are used
     to initialize the switch:

	o     VALUE="0" where the switch is initialized to the off
              position.
        o     VALUE="OFF" where the switch is initialized to the off
              position.
	o     VALUE="1" where the switch is initialized to the on
              position.  This is the default if the VALUE= keyword
              is not used, or if the value of that keyword is anything
              other than these four values.
	o     VALUE="ON" where the switch is initialized to the on
              position.


Robinson                       On-Off Switch                      Page 4

Technical Description

	This document proposes a new value to be added to the set of
    controls available in the INPUT tag for HTML forms.  Comments are
    shown in parentheses, and are not part of the proposed enhancement.

	The change to the INPUT tag to provide for on-off switches is
    proposed as follows:

	<INPUT

                (The following standard keyword is used unchanged)

            NAME = "value"	  (The name is that passed to a CGI
                                   script, as usual)

        (The "TYPE=" standard keyword is updated to add the following:)

	    TYPE = "ONOFF"

              (The "VALUE=" keyword is optionally set as follows:)

            VALUE="0"             (The on-off switch is off)
            VALUE="OFF"		  (The on-off switch is off)
            VALUE="1"             (Default: the on-off switch is on)
            VALUE="ON"            (The on-off switch is on)

		(No other keywords or values are allowed.)

	>


CGI Return values

	A CGI script receiving a response from a form which used the
    TYPE="ONOFF" keyword, the value specified in the NAME= keyword is
    returned, followed by the equal sign and the numeral 1 or a 0,
    depending on which was either set by the user or originally
    initialized if it was not changed.

	It is my understanding that all input objects which were defined
    on the form are returned as CGI response values when the form is
    submitted (and that is shown in the response example fragment below);
    if I am incorrect on this point, then only the changed items would be
    returned with the response on the "submit" button.


Example

	The following example HTML fragment should make this clear:

	    <FORM METHOD="POST" ACTION="/cgi/house">
            Here is the state of your house:
            <BR>
            <INPUT NAME="Air" TYPE="ONOFF" VALUE="0"> Conditioner
            &NBSP;&NBSP;
            <INPUT NAME="Living" TYPE="ONOFF" VALUE="0"> Room Lights
            &NBSP;&NBSP;
            <INPUT NAME="Bedroom" TYPE="ONOFF" VALUE="1"> Lights
            <BR>
            <INPUT NAME="Hall" TYPE="ONOFF" VALUE="OFF"> Lights
            &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
            <INPUT NAME="Front" TYPE=ONOFF> Porch Lights
            &NBSP;&NBSP;
            <INPUT NAME="Back" TYPE=ONOFF VALUE="ON"> Yard Lights
            <BR>

       More items (such as the "reset" and "submit" buttons) would
   follow but are not relevant to this discussion.  (Is the light on in
   the refrigerator when the door is closed?)

       The above fragment would (in part) show something similar to the
   following (Note: for the purposes of this text document, where "v"
   shows below, it represents an image of a light switch in the "off"
   position, and where "^" shows below, it represents an image of a
   light switch in the "on" position):


        Here is the state of your house:

        V Air Conditioner   V Living Room Lights  ^ Bedroom Lights
        V Hall Lights       ^ Front Porch Lights  ^ Back Yard Lights


	If the user were to change nothing and click on the submit
   button, the following would be returned to the CGI program:

	Air=0&Living=0&Bedroom=1&Hall=0&Front=1&Back=1

	If the user clicked on the air conditioner indicator, then the
   submit button, the following would be returned to the CGI program:

        Air=1&Living=0&Bedroom=1&Hall=0&Front=1&Back=1





Robinson                       On-Off Switch                      Page 5


Other Possibilities

	The creation of this feature may allow the use of the World
   Wide Web as a front-end for Full Screen Panel selection and changing
   of values for SNMP controller applications.  The possible uses for
   such a feature are limitless, seem to be extremely useful, and thus
   I propose and recommend adoption of this input object as a standard
   feature for HTML forms input.


Settings and Conflict Resolution

    o    The default setting for an ONOFF switch is "ON" or "1".
    o    Illegal VALUE= settings are ignored.
    o    If more than one of VALUE="0", VALUE="1", VALUE="ON" or
         VALUE="OFF" is used in an <INPUT> tag, the last one used
         is the one that is effective.
    o    The response returned to CGI for the substitution of the
         NAME="value" parameter, is value=0 or value=1 only.


Security Considerations

	Are not explored by this memo.


Author's Address

	Paul Robinson  <PAUL@TDR.COM>
	Tansin A. Darcos & Company/TDR, Inc.
	8604 Second Ave #104
	Silver Spring, MD 20901 USA

	For Comments about this memo:  ONOFF@TDR.COM