# Dashboard template: HTML form output without POST method

**URL:** <https://discourse.nodered.org/t/dashboard-template-html-form-output-without-post-method/15318>\
**Category:** Dashboard\
**Created:** [9 September 2019 12:48 UTC](https://discourse.nodered.org/t/dashboard-template-html-form-output-without-post-method/15318 "2019-09-09T12:48:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chandrashekar](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@chandrashekar](https://discourse.nodered.org/u/chandrashekar)\
**Post date:** [9 September 2019 12:48 UTC](https://discourse.nodered.org/t/dashboard-template-html-form-output-without-post-method/15318/1 "2019-09-09T12:48:38Z")

</div>

I have a html form in dashboard template.  
iam trying to get payload containing form values without POST method.

POST method works fine.

i want form values in an array or an object format upon submitting the form. but dont want the POST method which will take it to different URL. On submitting form i want to remain in same page but i should get payload.

if anyone can guide with an example it would be good.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [9 September 2019 14:42 UTC](https://discourse.nodered.org/t/dashboard-template-html-form-output-without-post-method/15318/2 "2019-09-09T14:42:52Z")

</div>

If you set the response code to 304 - it should tell the browser that the page is not modified and so it should not move away - [https://www.restapitutorial.com/httpstatuscodes.html](https://www.restapitutorial.com/httpstatuscodes.html)  
This may not be what you really want - as you usually expect to get some feedback... but...

---

<div class="post-metadata">

**Author:** ![Alacritous](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Alacritous](https://discourse.nodered.org/u/Alacritous)\
**Post date:** [10 September 2019 00:18 UTC](https://discourse.nodered.org/t/dashboard-template-html-form-output-without-post-method/15318/3 "2019-09-10T00:18:48Z")

</div>

I would use JavaScript to form a JSON packet or a GET request with the information and submit it to a handler on the webserver.

In node-red you can send an http request to an http input node and handle the request and response in a function.

you can create a script in the webpage that will take the form elements and put them together into a get request without using the form. This won't navigate way from the page unless you want it to.

For example, this is how I send stuff to my MQTT broker from various places on my network that don't have MQTT functionality built in. I use this mostly from Tasker on my phone. I don't like any of the Tasker MQTT clients. So I just make Tasker send a get request to node-red.

Anything can send an http GET to my node-red server that looks like this.

`http://192.168.0.18:1880/mqttin?t=<topic>&v=<value to be set>`

Anything that can make an http get request can do it.

```auto
[
    {
        "id": "7cc5a391.4e129c",
        "type": "http in",
        "z": "69aac232.e405ec",
        "name": "mqttservice",
        "url": "/mqttin",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 110,
        "y": 40,
        "wires": [
            [
                "92a4d05f.790f68"
            ]
        ]
    },
    {
        "id": "d865d6ab.68c738",
        "type": "mqtt out",
        "z": "69aac232.e405ec",
        "name": "Send package to MQTT server",
        "topic": "",
        "qos": "",
        "retain": "",
        "broker": "5e8886da.2dbd9",
        "x": 670,
        "y": 40,
        "wires": []
    },
    {
        "id": "ff83b65e.00f328",
        "type": "http response",
        "z": "69aac232.e405ec",
        "name": "HTTP response to request",
        "statusCode": "",
        "headers": {},
        "x": 660,
        "y": 80,
        "wires": []
    },
    {
        "id": "92a4d05f.790f68",
        "type": "function",
        "z": "69aac232.e405ec",
        "name": "Convert from URL GET to msg object",
        "func": "msg.topic = msg.payload.t;\nmsg.payload = msg.payload.v;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 370,
        "y": 40,
        "wires": [
            [
                "d865d6ab.68c738",
                "ff83b65e.00f328"
            ]
        ]
    },
    {
        "id": "5e8886da.2dbd9",
        "type": "mqtt-broker",
        "z": "",
        "name": "localMQTT",
        "broker": "192.168.0.18",
        "port": "1883",
        "clientid": "NR",
        "usetls": false,
        "compatmode": false,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    }
]

```

There are many assorted ways to accomplish this in javascript.

Here's where you can start.

> **[Here are the most popular ways to make an HTTP request in JavaScript](https://www.freecodecamp.org/news/here-is-the-most-popular-ways-to-make-an-http-request-in-javascript-954ce8c95aaa/)**
>
> by SaidHayani@
> 
> Here are the most popular ways to make an HTTP request in JavaScript
> JavaScript has great modules and methods to make HTTP requests that can be used
> to send or receive data from a server side resource. In this article, we are
> going to...

---

<div class="post-metadata">

**Author:** ![chandrashekar](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@chandrashekar](https://discourse.nodered.org/u/chandrashekar)\
**Post date:** [10 September 2019 05:16 UTC](https://discourse.nodered.org/t/dashboard-template-html-form-output-without-post-method/15318/4 "2019-09-10T05:16:16Z")

</div>

thanks this worked

---

<div class="post-metadata">

**Author:** ![chandrashekar](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@chandrashekar](https://discourse.nodered.org/u/chandrashekar)\
**Post date:** [10 September 2019 05:18 UTC](https://discourse.nodered.org/t/dashboard-template-html-form-output-without-post-method/15318/5 "2019-09-10T05:18:00Z")

</div>

Thanks will try to handle things within javascript for my future projects , thanks for this information.

Currently used response 304 for the solution
