Dealing with html files is often an error prone task. The helper class contains methods to generate the most common html sequences for anchors, forms and more.
resp = getHeader("Index");resp += makeCheckBox(makeIdent("method_enable_", i),
"on", meth->isEnabled()); resp += getTail();
![]()
![]() | Create a standard html start sequence. |
![]() | Append a check box with unique name and according value. |
![]() | Append the standard html tail sequence. |
When you process the form data you have to extract the according values. This may happen in the following manner:
CppString handle_calc(const HtmlFormData &formdata, CppString &mimetype) { mimetype = "text/html"; if ( formdata.size() != 0 && formdata.hasElement("lhs")&& formdata.hasElement("rhs") && formdata.hasElement("operator") ) { int l = getLong(formdata.getElement("lhs")[0]);
int r = getLong(formdata.getElement("rhs")[0]); ... } return calc_response();
}
![]() | Check for existing and complete form data. |
![]() | Extract the values and process them as required. |
![]() | Generate the response based on the current data. |