How to set a custom attribute on form payload to webhook

Hi, I’m trying to include an extra attribute (‘DB_table’, “some-fixed-value-here”) to the form payload so that the webhook could receive that value along with the actual form input field content. After some serious trying, only the standard form input field content gets passed via webhook. See the images:

This how the page ID is set:

Embed code used on Webflow page to try to force the fixed attribute to be part of that form page / element ID:

<script>
  Webflow.push(function() {
      document.getElementById('DB_question').setAttribute('DB_table', "some-fixed-value-here")
  });
</script>

But the payload received via webhook shows only the standard form input field:

How do I get to “force in” a hard coded name-value pair to that payload? The rest of the process needs the indication from which site the form content is coming from and because of webhook detects the static data structure, we cannot vary that ID.

If we get this working, then the payload should look like:

  • DB_question: some answer text here
  • DB_table: some-fixed-value-here

Hi @raulipadding thanks for your post.

I am not entirely sure how your webhook is working, but you can set custom data attributes on the form block elements itself, see this article: Custom attributes | Webflow University

If that does not work, you might also be able to setup a hidden field using a manual html form input field and putting that manual html tag inside of a custom code embed placed within the form wrapper and try that.

I hope this helps

There you go Dave!

The first one I already tested and no go but the second one seems to be exactly what I was after! HTML input type="hidden"

Give a moment to try it out.

It works. Dave’s second idea is correct answer :white_check_mark:

and the code used in our case:

<input type="hidden" id="DB_question" name="DB_table" value="some-fixed-value-here">

Hi @raulipadding, that is great to hear, I am glad that it helped :slight_smile:

Thanks for being awesome, have a great day :slight_smile:

I guess you know quite a bit of all possible tricks for Webflow :grinning: Same, have a great day.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.