os_input_checkbox


An input checkbox within a form.

An os_input_checkbox presents a choice that can either be checked or unchecked within an os_form . An os_input_checkbox is rendered as a checkbox icon. An os_input_checkbox is initially unchecked by default. The default can be changed to initially checked through either a constructor or the check() member function.

Each os_input_checkbox has a name, a value, and a marker, which are specified in a constructor and can be modified through the name() , value() , and marker() member functions. The same name can be specified for more than one os_input_checkbox to indicate that all represent choices within the same category.

If an os_input_checkbox is checked when the containing os_form is submitted, the name and value pair are transmitted. os_input_checkbox allows multiple choices within the same category to be selected. All os_input_checkbox elements with the same name are part of the same category. If you want to restrict the category to a single choice, use the class os_input_radio instead.

By default, a marker that labels the choice is positioned on the right of the checkbox icon. The position of the marker can be specified through either a constructor or the position() member function.

An os_input_checkbox need not specify a name if it is created for insertion into an os_checkbox_group . Upon insertion, the os_input_checkbox assumes both the name and marker position specified in the os_checkbox_group .

Declaration

#include <ospace/web/incheck.h>
class os_input_checkbox : public os_element

Enums

enum os_input_checkbox::marker_position
  {
  marker_right,  // Places the marker to the right of the checkbox.
  marker_left    // Places the marker to the left of the checkbox.
  };


enum os_input_checkbox::check_type
  {
  not_checked,   // Sets the checkbox to the unselected state.
  checked        // Sets the checkbox to the selected state.
  };
	

Interface

Constructor
os_input_checkbox( const string& name , const string& value , const os_element& element , check_type check , marker_position position )
Constructs an input checkbox with the associated pair name and value , and attaches a copy of element at position (default marker_right ). Starts in the check (default not_checked ) state.
Constructor
os_input_checkbox( const string& name , const string& value , const string& text , check_type check , marker_position position )
Constructs an input checkbox with the associated pair name and value , and attaches an os_text element created from text at position (default marker_right ). Starts in the check (default not_checked ) state.
Constructor
os_input_checkbox( const string& value , const os_element& element , check_type check , marker_position position )
Constructs an input checkbox with the associated pair "checkbox" and value , and attaches a copy of element at position (default marker_right ). Starts in the check (default not_checked ) state.
Constructor
os_input_checkbox( const string& value , const string& text , check_type check , marker_position position )
Constructs an input checkbox with the associated pair "checkbox" and value , and attaches an os_text element created from text at position (default marker_right ). Starts in the check (default not_checked ) state.
Constructor
os_input_checkbox( const os_input_checkbox& rhs )
Constructs an input checkbox that is a copy of rhs .
Destructor
/* virtual */ ~os_input_checkbox()
Destroys the input checkbox.
=
os_input_checkbox& operator=( const os_input_checkbox& rhs )
Replaces the input checkbox contents with a copy of rhs and returns a reference to the input checkbox.
check
int check() const
Returns the initial check state.
check
os_input_checkbox& check( check_type check )
Sets the check status to check and returns a reference to the input checkbox.
clone
/* virtual */ os_element* clone() const
Returns a base class pointer to a heap-based deep copy of the input checkbox.
marker
os_input_checkbox& marker( const os_element& element )
Sets the display marker to a copy of element and returns a reference to the input checkbox.
marker
os_element* marker() const
Returns a pointer to the display marker.
marker
os_input_checkbox& marker( const string& text )
Sets the display marker to an os_text element created from text and returns a reference to the input checkbox.
name
string name() const
Returns the name.
name
os_input_checkbox& name( const string& name )
Sets the name to name and returns a reference to the input checkbox.
position
os_input_checkbox& position( marker_position position )
Sets the position of the display marker to position and returns a reference to the input checkbox.
position
int position() const
Returns the display marker position.
print
void print( ostream& os ) const
Prints the input checkbox to os .
value
os_input_checkbox& value( const string& value )
Sets the value to value and returns a reference to the input checkbox.
value
string value() const
Returns the value.

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved