From f3f67af69ee554ed07579554140e63a66b924f21 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 22 Nov 2020 11:07:45 +0200 Subject: [PATCH] Added: form,formaction attributes to submit button --- nel/src/gui/group_html.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 6694200bf..6c27461f4 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -5417,7 +5417,7 @@ namespace NLGUI // *************************************************************************** void CGroupHTML::insertFormImageButton(const std::string &name, const std::string &tooltip, const std::string &src, const std::string &over, const std::string &formId, const std::string &action, uint32 minWidth, const std::string &templateName) { - _FormSubmit.push_back(SFormSubmitButton(formId, name, "", "image")); + _FormSubmit.push_back(SFormSubmitButton(formId, name, "", "image", action)); // Action handler parameters std::string param = "name=" + getId() + "|button=" + toString(_FormSubmit.size()-1); @@ -5428,7 +5428,7 @@ namespace NLGUI // *************************************************************************** void CGroupHTML::insertFormTextButton(const std::string &name, const std::string &tooltip, const std::string &value, const std::string &formId, const std::string &formAction, uint32 minWidth, const std::string &templateName) { - _FormSubmit.push_back(SFormSubmitButton(formId, name, value, "submit")); + _FormSubmit.push_back(SFormSubmitButton(formId, name, value, "submit", formAction)); // Action handler parameters string param = "name=" + getId() + "|button=" + toString(_FormSubmit.size()-1); @@ -6065,16 +6065,27 @@ namespace NLGUI string name = elm.getAttribute("name"); string src = elm.getAttribute("src"); string over = elm.getAttribute("data-over-src"); + string formId = elm.getAttribute("form"); + string formAction = elm.getAttribute("formaction"); - insertFormImageButton(name, tooltip, src, over, _Forms.back().id, "", minWidth, templateName); + if (formId.empty() && _FormOpen) { + formId = _Forms.back().id; + } + + insertFormImageButton(name, tooltip, src, over, formId, formAction, minWidth, templateName); } else if (type == "button" || type == "submit") { - // The submit button string name = elm.getAttribute("name"); string value = elm.getAttribute("value"); + string formId = elm.getAttribute("form"); + string formAction = elm.getAttribute("formaction"); + + if (formId.empty() && _FormOpen) { + formId = _Forms.back().id; + } - insertFormTextButton(name, tooltip, value, _Forms.back().id, "", minWidth, templateName); + insertFormTextButton(name, tooltip, value, formId, formAction, minWidth, templateName); } else if (type == "text") {