How to pass the value using submit button in nodejs? instead of using form action='/pass'
suppose i used two submit buttons with different values how can i do it??
How to pass the value using submit button in nodejs? instead of using form action='/pass'
suppose i used two submit buttons with different values how can i do it??
The action
attribute of the form determines the URL that the data will be submitted to. It has nothing to do with the values sent to that URL.
Values is handled in the same way as any control (i.e. with the name
and value
attributes):
<button name="some-name" value="some-value">Some label</button>
If you wanted to override the form action from a button, then you can use the new formaction
attribute:
<button formaction="/some/url" name="some-name" value="some-value">Some label</button>
(And this is standard HTTP and not web server specific in any way, so it has nothing to do with Node.js. Another question might ask how to process data submitted from a form, but it would depend on which HTTP library you were using).