Glimmr Form Fields

version 1/101201 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next

  • Section - Numerical fields and filter
    [A field can be identified as "numerical," in which case the typed string will automatically be converted into a number by the input interpretation rules (see below). Only numeric characters are counted—a pure text string will produce a value of 0.]

    A g-element has a number called the associated value. A g-element can be numerical. A g-element is usually not numerical.

    [A filter is provided that can be applied, if the author likes, to numerical fields. This filter will allow only digits and hyphen (minus sign) to be entered into the field. The filter itself can be customized as needed. Indeed, two phrases for customizing it are included; these will remove the hyphen from the allowed input—restricting the field to positive digits—or restore these characters to the filter if previously removed. To be effective, these phrases must be invoked before the numerical filter is applied to a field, e.g.:

    When play begins:
        disallow negative values in numerical filter;
        repeat with item running through numerical g-elements[input fields, if using that kind]:
            now the accepted standard input of item is the numerical filter.]

    The numerical filter is a list of numbers variable. The numerical filter is {45[hyphen for negative numbers], 48, 49, 50, 51, 52, 53, 54, 55, 56, 57}.

    To disallow negative values in (filter - a list of numbers):
        remove 45 from the filter.

    To allow negative values in (filter - a list of numbers):
        add 45 to the filter.