Aggregate to the supplied chain, HTML to manifest a button. The button can be a link (GET request) OR a form action (POST request). In the link case, button member m_Linkto will give the location. In the form action case, there will need to be submission URL which is obtained from the form reference (given in HTTP event variable m_pContextForm). Returns: None
| Return Type | Function name | Arguments |
|---|---|---|
| void | hdsButton::Generate | (hzChain&,hzHttpEvent*,uint32_t&,) |
Declared in file: hzDissemino.h
Defined in file : hdsGenerate.cpp
Function Logic:
Function body:
void hdsButton::Generate (hzChain& C)hzHttpEvent* pE, uint32_t& nLine,
{
// Aggregate to the supplied chain, HTML to manifest a button.
//
// The button can be a link (GET request) OR a form action (POST request). In the link case, button member m_Linkto will give the location. In the form action case, there will
// need to be submission URL which is obtained from the form reference (given in HTTP event variable m_pContextForm).
//
// Arguments: 1) C The HTML output chain
// 2) pE The HTTP event being responded to
// 3) nLine Line number tracker (controls NL printing)
//
// Returns: None
_hzfunc("hdsButton::Generate") ;
hdsFormref* pFR ; // Form reference
hzString url ; // URL to use (if form action)
uint32_t x ; // Indent counter
if (m_Line != nLine)
{
C.AddByte(CHAR_NL) ;
for (x = m_Indent ; x ; x--)
C.AddByte(CHAR_TAB) ;
nLine = m_Line ;
}
if (pE->m_pContextForm)
{
pFR = (hdsFormref*) pE->m_pContextForm ;
x = m_pApp->m_FormRef2Url.First(pFR) ;
if (x >&eq; 0)
url = m_pApp->m_FormRef2Url.GetObj(x + m_Resv - 1);
}
if (m_Formname)
{
if (url)
C.Printf("<input type=\"submit\" formaction=\"%s\" value=\"%s\">", *url, *m_strContent) ;
else
C.Printf("<input type=\"submit\" value=\"%s\">", *m_strContent) ;
}
else
{
if (pE && m_Linkto[0]== CHAR_PERCENT)
C.Printf("<input type=\"button\" value=\"%s\" onclick=\"window.location.href='%s'\">", *m_strContent, *m_pApp->ConvertText(m_Linkto, pE)) ;
else
C.Printf("<input type=\"button\" value=\"%s\" onclick=\"window.location.href='%s'\">", *m_strContent, *m_Linkto) ;
}
}