#include <Select.h>
Public Member Functions | |
void | printHTML (xgi::Output *out) |
Select (std::string the_url, std::string top, std::string left, std::string the_requestID, std::string the_name) | |
void | setOptionsVector (std::vector< std::string > the_options_v) |
~Select () | |
Private Attributes | |
std::string | name |
std::vector< std::string > | options_v |
std::string | requestID |
This is the class that should be instantiated in case the user wants to have a select menu, the elements of which, submit a request when clicked on.
Select::Select | ( | std::string | the_url, |
std::string | top, | ||
std::string | left, | ||
std::string | the_requestID, | ||
std::string | the_name | ||
) | [inline] |
void Select::printHTML | ( | xgi::Output * | out | ) | [virtual] |
Implements WebElement.
Definition at line 4 of file Select.cc.
References WebElement::get_pix_left(), WebElement::get_pix_top(), WebElement::get_url(), name, options_v, position, requestID, benchmark_cfg::select, and asciidump::table.
{ std::string position = "position:absolute; left:" + get_pix_left() + "; top:" + get_pix_top(); // the javascript function makeSelectRequest expects the url of the request and the id of the widget // Example: makeSelectRequest('https://[ApplicationURL]/Request?RequestID=MyCustomRequest', 'select menu 1'); std::string applicationURL = get_url(); std::string requestName = "RequestID=" + requestID; std::string js_command = "makeSelectRequest('" + applicationURL + "/Request?" + requestName + "'" + ", '" + name + "')"; *out << cgicc::div().set("style", position.c_str()) << std::endl; // The id of the form is the name of the select menu + " Form". *out << cgicc::form().set("name", name + " Form").set("id", name + " Form") << std::endl; *out << cgicc::table() << std::endl; *out << cgicc::tr() << std::endl << cgicc::td() << std::endl << name << ":" << std::endl << cgicc::td() << std::endl; *out << cgicc::td() << std::endl; *out << cgicc::select().set("name", name).set("id", name).set("onchange", js_command) << std::endl; *out << cgicc::option().set("value", "").set("selected") << cgicc::option() << std::endl; for (std::vector<std::string>::iterator it = options_v.begin(); it != options_v.end(); it++) { *out << cgicc::option().set("value", *it) << *it << cgicc::option() << std::endl; } *out << cgicc::select() << std::endl; *out << cgicc::td() << std::endl; *out << cgicc::tr() << std::endl; *out << cgicc::table() << std::endl; *out << cgicc::form() << std::endl; *out << cgicc::div() << std::endl; }
void Select::setOptionsVector | ( | std::vector< std::string > | the_options_v | ) | [inline] |
std::string Select::name [private] |
Definition at line 18 of file Select.h.
Referenced by printHTML(), and Select().
std::vector<std::string> Select::options_v [private] |
Definition at line 21 of file Select.h.
Referenced by printHTML(), and setOptionsVector().
std::string Select::requestID [private] |
Definition at line 19 of file Select.h.
Referenced by printHTML(), and Select().