htmlOption
Selection list option class
[Previous] [Main] [Next]


Description
htmlMeta encapsultes the <OPTION> tag, and is used to specify an option in a selection list on a form. Selection lists are created using the htmlInputSelect class.  
 
There are three data items associated with each option:  
  • value The value sent to the server when the form is submitted (optional).
  • content The text displayed in the selection list. In the absence of a value, the content will be sent when the form is submitted.
  • selection status Controls whether or not the option is selected by default in the selection list when displayed by the browser. The default is NOT_SELECTED.
 
When the form containing the selection list is submitted to the server, a name/value pair is sent for each selected option in the list. An option may be pre-selected in the browser using the Select() method.  
 
Declaration
#include <dcmicro/htmlpp/option.h>  
 
Hierarchy
htmloption.gif  
 
See Also
htmlInputSelect  
 
Related Constants/Definitions
#define SELECTED      TRUE  
#define NOT_SELECTED   FALSE  
 
Constructors
htmlOption()  
Constructs an empty option object.  
 
htmlOption(const String& display_content,  
   Boolean enable_select = NOT_SELECTED )  
Constructs an option object for display_content. If enable_select is TRUE, the option will be selected by default on the browser.  
 
htmlOption(const String& value,  
   const String& display_content,  
   Boolean enable_select = NOT_SELECTED )  
Constructs an option object using  
 
htmlOption( const htmlOption& rhs )  
Copy constructor.  
 
Destructor
virtual ~htmlOption()  
Destroys the object.  
 
Member Methods
=   htmlOption& operator= ( const htmlOption& rhs )  
Replaces the object contents with rhs, then returns a reference to the object.  
 
ContenthtmlOption& Content( const String& display_content )  
Sets the display content of the option to display_content, then returns a reference to the object.  
 
ContentString Content() const  
Returns the display content of the option as a string, or an empty string if not set.  
 
SelecthtmlOption& Select( Boolean enable_select = SELECTED )  
Sets the selection state of the option, and returns a reference to the object. If enable_select is TRUE, the option will be pre-selected when displayed by the browser.  
 
IsSelectedBoolean IsSelected() const  
Returns SELECTED (TRUE) if the option is marked as selected, or NOT_SELECTED (FALSE) otherwise.  
 
ValuehtmlOption& Value( const String& value )  
Sets the value of the option to value, then returns a reference to the object. Unless a value is specified, the content will be returned to the server when the form is submitted.  
 
ValueString Value() const  
Returns the option value as a string, or an empty string if not set.  
 
Print   void Print( ostream& os ) const  
Outputs the object to os.  
 
ClonehtmlObject FAR * Clone() const  
Returns a base-class pointer to a deep copy of the object.  
 
Example

See the example in Tutorial:Forms:Selection Lists  




©1998 DC Micro Development. All rights reserved.
No portion of this document may be c opied or reproduced without expressed written consent.
html++ is a trademark of DC Micro Development.