-4

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??

Gokul
  • 17
  • 1
  • 2
  • 1
    Try to give us examples of what you have tried, try to give us part of the relevant code so we can understand and help you. – Richard Fazzi Feb 24 '20 at 14:43
  • seems like a duplicate https://stackoverflow.com/questions/547821/two-submit-buttons-in-one-form – ymz Feb 24 '20 at 14:45

1 Answers1

1

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).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335