Send data of forms in HTML on output of template without use DASHBOARD?!


I want to use my code instead of dashboard to send data to my function in node-red. How i can do it ?
thank you for your help.

> <form>
>   First name:<br>
>   <input type="text" name="firstname" value="Mickey">
>   <br>
>   Last name:<br>
>   <input type="text" name="lastname" value="Mouse">
>   <br><br>
>   <input type="submit" value="Submit">
> </form>



you may need to explain a bit more what you mean.

Do you mean you have a webpage with that form on and you want to press the submit button on that form and send the results to a Node-RED flow?

If that is correct, then the general approach you need is to use an HTTP In node to create a flow that listens for an HTTP Post from the form with the form-data in.

First you would update the <form> you have to include an action - this identifies the URL the form will post its data to. For example:

<form action="/my-node-red-flow">

You can then create flow that starts with the HTTP In node configured to list for POST requests to /my-node-red-flow. Wire that to both a Debug node and an HTTP Response node.

Then when you click the submit button, your browser will make the HTTP post request back to node-red and trigger the http flow you have created.

Of course there are lots of hidden details here such as exactly what path you should use or what action to set on the form - those are the sorts of details we can't advise you on without more details from you.



Thank youuuuuu it's woork (y)