Browse Source

use getOnlineWebResource and then call doc's handleResponse

master
Odilitime 4 years ago
parent
commit
9f7bdc3fe2
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      src/graphics/elements/BUTTONElement.cpp

+ 6
- 5
src/graphics/elements/BUTTONElement.cpp View File

@@ -5,6 +5,7 @@
#include "../components/DocumentComponent.h"
#include "../../WebResource.h"
#include "../../Log.h"
#include "../../FormData.h"

BUTTONElement::BUTTONElement() {
isInline = true;
@@ -23,7 +24,7 @@ std::unique_ptr<Component> BUTTONElement::renderer(const ElementRenderRequest &r
butComponent->name = "button";
butComponent->onClick=[tagNode, request]() {
// recurse up to find oug form tag
std::shared_ptr<Node> formNode = findFormNode(request.node);
std::shared_ptr<Node> formNode = Node::findTagNodeParent("form", request.node);
if (!formNode) {
std::cout << "BUTTONElement::renderer:butComponent->onClick - Can't find form parent for submit" << std::endl;
return;
@@ -59,8 +60,8 @@ std::unique_ptr<Component> BUTTONElement::renderer(const ElementRenderRequest &r
URL uAction = request.docComponent->currentURL.merge(URL(formNodeActionIter->second));
std::cout << "Action URL is " << uAction.toString() << std::endl;
// download URL
WebResource res = postWebResource(uAction, std::move(formData));
handleResource(res, uAction.toString(), request.docComponent);
WebResource res = getOnlineWebResource(uAction, std::move(formData));
request.docComponent->handleResource(res, uAction.toString());
} else {
// need documentComponent
@@ -84,8 +85,8 @@ std::unique_ptr<Component> BUTTONElement::renderer(const ElementRenderRequest &r
URL uAction = request.docComponent->currentURL.merge(URL(formNodeActionIter->second+"?"+queryString));
std::cout << "Action URL is " << uAction.toString() << std::endl;
// download URL
WebResource res = postWebResource(uAction, nullptr);
handleResource(res, uAction.toString(), request.docComponent);
WebResource res = getOnlineWebResource(uAction, nullptr);
request.docComponent->handleResource(res, uAction.toString());
}

};

Loading…
Cancel
Save