Fixed: html button with empty formid attribute

feature/pre-code-move
Nimetu 5 years ago
parent 8be553401d
commit 2191d21bce

@ -683,6 +683,8 @@ namespace NLGUI
std::vector<CEntry> Entries; std::vector<CEntry> Entries;
}; };
std::vector<CForm> _Forms; std::vector<CForm> _Forms;
// if <FORM> element has been closed or not
bool _FormOpen;
// submit buttons added to from // submit buttons added to from
struct SFormSubmitButton struct SFormSubmitButton
@ -953,6 +955,7 @@ namespace NLGUI
//void htmlEM(const CHtmlElement &elm); //void htmlEM(const CHtmlElement &elm);
void htmlFONT(const CHtmlElement &elm); void htmlFONT(const CHtmlElement &elm);
void htmlFORM(const CHtmlElement &elm); void htmlFORM(const CHtmlElement &elm);
void htmlFORMend(const CHtmlElement &elm);
void htmlH(const CHtmlElement &elm); void htmlH(const CHtmlElement &elm);
void htmlHend(const CHtmlElement &elm); void htmlHend(const CHtmlElement &elm);
void htmlHEAD(const CHtmlElement &elm); void htmlHEAD(const CHtmlElement &elm);

@ -1201,7 +1201,7 @@ namespace NLGUI
case HTML_DT: htmlDTend(elm); break; case HTML_DT: htmlDTend(elm); break;
case HTML_EM: renderPseudoElement(":after", elm);break; case HTML_EM: renderPseudoElement(":after", elm);break;
case HTML_FONT: break; case HTML_FONT: break;
case HTML_FORM: renderPseudoElement(":after", elm);break; case HTML_FORM: htmlFORMend(elm); break;
case HTML_H1://no-break case HTML_H1://no-break
case HTML_H2://no-break case HTML_H2://no-break
case HTML_H3://no-break case HTML_H3://no-break
@ -1456,6 +1456,7 @@ namespace NLGUI
_RenderNextTime = false; _RenderNextTime = false;
_WaitingForStylesheet = false; _WaitingForStylesheet = false;
_AutoIdSeq = 0; _AutoIdSeq = 0;
_FormOpen = false;
// Register // Register
CWidgetManager::getInstance()->registerClockMsgTarget(this); CWidgetManager::getInstance()->registerClockMsgTarget(this);
@ -3274,6 +3275,7 @@ namespace NLGUI
_Cells.clear(); _Cells.clear();
_TR.clear(); _TR.clear();
_Forms.clear(); _Forms.clear();
_FormOpen = false;
_FormSubmit.clear(); _FormSubmit.clear();
_Groups.clear(); _Groups.clear();
_Divs.clear(); _Divs.clear();
@ -5579,6 +5581,11 @@ namespace NLGUI
std::string tooltip = elm.getAttribute("tooltip"); std::string tooltip = elm.getAttribute("tooltip");
bool disabled = elm.hasAttribute("disabled"); bool disabled = elm.hasAttribute("disabled");
if (formId.empty() && _FormOpen)
{
formId = _Forms.back().id;
}
if (!formAction.empty()) if (!formAction.empty())
{ {
formAction = getAbsoluteUrl(formAction); formAction = getAbsoluteUrl(formAction);
@ -5851,6 +5858,8 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CGroupHTML::htmlFORM(const CHtmlElement &elm) void CGroupHTML::htmlFORM(const CHtmlElement &elm)
{ {
_FormOpen = true;
// Build the form // Build the form
CGroupHTML::CForm form; CGroupHTML::CForm form;
// id check is case sensitive and auto id's are uppercase // id check is case sensitive and auto id's are uppercase
@ -5875,6 +5884,12 @@ namespace NLGUI
renderPseudoElement(":before", elm); renderPseudoElement(":before", elm);
} }
void CGroupHTML::htmlFORMend(const CHtmlElement &elm)
{
_FormOpen = false;
renderPseudoElement(":after", elm);
}
// *************************************************************************** // ***************************************************************************
void CGroupHTML::htmlH(const CHtmlElement &elm) void CGroupHTML::htmlH(const CHtmlElement &elm)
{ {

Loading…
Cancel
Save