CppCMS
Classes | Public Member Functions
cppcms::widgets::select_multiple Class Reference

This widget represents an HTML multiple select form element. More...

#include <cppcms/form.h>

Inheritance diagram for cppcms::widgets::select_multiple:
cppcms::widgets::base_widget cppcms::base_form booster::noncopyable cppcms::form_flags

List of all members.

Classes

struct  element

Public Member Functions

void add (std::string const &msg, bool selected=false)
void add (std::string const &msg, std::string const &id, bool selected=false)
void add (locale::message const &msg, bool selected=false)
void add (locale::message const &msg, std::string const &id, bool selected=false)
std::vector< bool > selected_map ()
std::set< std::string > selected_ids ()
unsigned at_least ()
void at_least (unsigned v)
unsigned at_most ()
void at_most (unsigned v)
void non_empty ()
unsigned rows ()
void rows (unsigned n)
virtual void render_input (form_context &context)
virtual bool validate ()
virtual void load (http::context &context)
virtual void clear ()

Detailed Description

This widget represents an HTML multiple select form element.


Member Function Documentation

void cppcms::widgets::select_multiple::add ( std::string const &  msg,
bool  selected = false 
)

Add to the multiple select a new option with the display name msg, and specify if it is initially selected. The default is false.

void cppcms::widgets::select_multiple::add ( std::string const &  msg,
std::string const &  id,
bool  selected = false 
)

Add to the multiple select a new option with the display name msg, and specify if it is initially selected (the default is false), providing a unique identification string to use as the element's id.

void cppcms::widgets::select_multiple::add ( locale::message const &  msg,
std::string const &  id,
bool  selected = false 
)

Add to the multiple select a new option with the localized display name msg, and specify if it is initially selected (the default is false), providing a unique identification string to use as the element's id.

void cppcms::widgets::select_multiple::add ( locale::message const &  msg,
bool  selected = false 
)

Add to the multiple select a new option with the localized display name msg, and specify if it is initially selected. The default is false.

void cppcms::widgets::select_multiple::at_least ( unsigned  v)

Set the minimum amount of options that can be chosen. The default is 0.

unsigned cppcms::widgets::select_multiple::at_least ( )

Get the minimum amount of options that can be chosen. The default is 0.

unsigned cppcms::widgets::select_multiple::at_most ( )

Get the maximum amount of options that can be chosen. The default is unlimited.

void cppcms::widgets::select_multiple::at_most ( unsigned  v)

Set the maximum amount of options that can be chosen. The default is unlimited.

virtual void cppcms::widgets::select_multiple::clear ( ) [virtual]

Clear the form. It also calls set(false).

Reimplemented from cppcms::widgets::base_widget.

virtual void cppcms::widgets::select_multiple::load ( http::context context) [virtual]

Load the form information from the provided http::context context. A user can call this function to load all information from the raw POST/GET data into the internal widget representation.

Implements cppcms::base_form.

void cppcms::widgets::select_multiple::non_empty ( )

Same as at_least(1).

virtual void cppcms::widgets::select_multiple::render_input ( form_context context) [virtual]

This is a virtual member function that should be implemented by each widget. It executes the actual rendering of the HTML form.

Implements cppcms::widgets::base_widget.

unsigned cppcms::widgets::select_multiple::rows ( )

Get the number of rows used to display the widget. The default is 0 -- undefined.

void cppcms::widgets::select_multiple::rows ( unsigned  n)

Set the number of rows used to display the widget. The default is 0 -- undefined.

std::set<std::string> cppcms::widgets::select_multiple::selected_ids ( )

Get all the selected items ids according to the order they where added to the list. If no specific id was given, a string like "0", "1"... will be used.

std::vector<bool> cppcms::widgets::select_multiple::selected_map ( )

Get the mapping of all the selected items according to the order they where added to the multiple select list.

virtual bool cppcms::widgets::select_multiple::validate ( ) [virtual]

Validate the form. If not overridden, it sets the widget to valid.

Reimplemented from cppcms::widgets::base_widget.


The documentation for this class was generated from the following file: