Using HTML Forms

Overview

Multi-part Elements

Some elements have more than one choice, or can submit more than one value.

SELECT elements

  1. Creating the form element. Populate a list of lists with values for the option list.

    set foo_options [db_list_of_lists foo_option_list "
        select foo,
               foo_id
          from foos
    "]
    

    The variable foo_options should resemble {{first foo} 1234} {{second foo} 1235}

    Within ad_form, set up the element to use this list:

    {foo:text(select)
            {label "Which Foo"}
            {options $foo_options}
        }

    This will result in a single name/value pair coming back in the submitted form. Handle this within the same ad_form structure, in the -new_data and -edit_data. In the example, it is available as $foo

See also the W3C spec for "The SELECT, OPTGROUP, and OPTION elements".

($Id: form-builder.html,v 1.1.2.2 2003/12/15 15:03:47 jeffd Exp $)
View comments on this page at openacs.org