ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahh_5.4.0.1/selform.htm

69 lines
4.2 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="SelectFormElement class" />
<meta name="abstract" content="" />
<meta name="description" content="" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="selform" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>SelectFormElement class</title>
</head>
<body id="selform"><a name="selform"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">SelectFormElement class</h1>
<div><p></p>
<div class="section"><p>The <a href="javadoc/com/ibm/as400/util/html/SelectFormElement.html"> SelectFormElement</a> class represents a select
input type for an HTML form. You can <a href="javadoc/com/ibm/as400/util/html/SelectFormElement.html#ADDOPTION(COM.IBM.AS400.UTIL.HTML.SELECTOPTION)"> add</a> and <a href="javadoc/com/ibm/as400/util/html/SelectFormElement.html#REMOVEOPTION(COM.IBM.AS400.UTIL.HTML.SELECTOPTION)"> remove</a> various <a href="selopt.htm#selopt">options</a> within
the select element. </p>
</div>
<div class="section"><p>SelectFormElement has methods available that allow you to view
and change attributes of the select element:</p>
</div>
<div class="section"><ul><li>Use <a href="javadoc/com/ibm/as400/util/html/SelectFormElement.html#REMOVEOPTION(COM.IBM.AS400.UTIL.HTML.SELECTOPTION)"> setMultiple()</a> to set whether or not the
user can select more than one option</li>
<li>Use <a href="javadoc/com/ibm/as400/util/html/SelectFormElement.html#GETOPTIONCOUNT()"> getOptionCount()</a> to determine how many
elements are in the option layout</li>
<li>Use <a href="javadoc/com/ibm/as400/util/html/SelectFormElement.html#SETSIZE(INT)"> setSize()</a> to set the number of options
visible within the select element and use <a href="javadoc/com/ibm/as400/util/html/SelectFormElement.html#GETSIZE()"> getSize()</a> to determine the number of visible
options.</li>
</ul>
</div>
<div class="section"><p>The following example creates a SelectFormElement object with
three options. The SelectFormElement object named <em>list</em>, is highlighted.
The first two options added specify the option text, name, and select attributes.
The third option added is defined by a <a href="selopt.htm#selopt">SelectOption</a> object.</p>
</div>
<div class="section"><div class="p"><pre> <strong>SelectFormElement list = new SelectFormElement("list1");</strong>
SelectOption option1 = <strong>list.addOption("Option1", "opt1")</strong>;
SelectOption option2 = <strong>list.addOption("Option2", "opt2", false)</strong>;
SelectOption option3 = new SelectOption("Option3", "opt3", true);
<strong>list.addOption(option3);</strong>
System.out.println(<strong>list.getTag()</strong>);</pre>
The above code example
produces the following HTML code: <pre> &lt;select name="list1"&gt;
&lt;option value="opt1"&gt;Option1&lt;/option&gt;
&lt;option value="opt2"&gt;Option2&lt;/option&gt;
&lt;option value="opt3" selected="selected"&gt;Option3&lt;/option&gt;
&lt;/select&gt;</pre>
</div>
</div>
</div>
</body>
</html>