Passing in additional metadata in Netlify form

I was wondering if there was a simple way you recommend for passing additional metadata along with a form submission. E.g. data like the URL of the page or page title. I would rather not have to do Vue or React to get this working, so I’ll appreciate any tips.

You’d have to put things into form fields that you had defined at deploy time. If you know the data, you can hardcode the fields right at build time. If you don’t, I don’t know a way to get that data other than via JS.

Makes sense. I’m not opposed to doing it via Javascript, but I’m just curious about what format it should be in. If I have a form like this:

<form name="contact" method="POST" netlify>
<p class="form-title"> Got any comments/feedback about this post?  Please send it through the form below! </p>
  <label for="name">Name</label>
  <input type="text" name="name" id="name" autocomplete="name" placeholder="Your name" title="Please enter your name" required>
  <label for="email">Email</label>
  <input type="email" name="email" id="email" autocomplete="email" placeholder="Your email address" title="The domain portion of the email address is invalid (the portion after the @)." pattern="^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*(\.\w{2,})+$" required>
  <label for="message">Message</label>
  <textarea name="message" id="message" placeholder="Write your message here" rows="7" required></textarea>
  <button type="submit" name="submit">Send Message</button>
</form>

Where in this HTML will the form metadata be? Will I create some hidden input fields?

unless you want people to see or modify them, hidden seems most useful, yes :slight_smile: