[Cppcms-users] Customized widgets input with tags
Brought to you by:
artyom-beilis
From: Eric J. <jan...@gm...> - 2019-05-17 05:45:39
|
Hi All, Kindly need your assistance for the implementation on how to create a customized widget input that derived from cppcms::widgets::base_html_input. Following is the way I did but unsuccessful: struct text_input : public cppcms::widgets::base_html_input { text_input(const std::string &s) : cppcms::widgets::base_html_input(s) { } virtual ~text_input() {} virtual void render_input(cppcms::form_context &context) { cppcms::widgets::base_html_input::render_input(context); } virtual void render_value(cppcms::form_context &context) { std::ostream &os = std::cout; context.html_list(cppcms::form_flags::as_p); context.html(cppcms::form_flags::as_html); os << "<input type=\"text\" style=\"font-size:20px; background-color:red;\">"; context.out(os); } }; I tried previously with editing the render_value content for out() to tags: "style=\"font-size:20px; background-color:red;" still not working. The struct implementation is as follow: struct info_form : public cppcms::form { std::string const s1 = "text"; text_input name(s1); cppcms::widgets::radio sex; cppcms::widgets::select marital; cppcms::widgets::numeric<double> age; cppcms::widgets::submit submit; info_form() { //name.message("Your Name"); sex.message("Sex"); marital.message("Marital Status"); age.message("Your Age"); submit.value("Send"); add(name); add(submit); add(sex); add(marital); add(age); sex.add("Male","male"); sex.add("Female","female"); marital.add("Single","single"); marital.add("Married","married"); marital.add("Divorced","divorced"); name.non_empty(); age.range(0,120); } Please let me know if you need anything else to show. Thank you and kind regards, *ERIC JANSEN* Software Engineer |