Discussions

Ask a Question
Back to All

Create hidden custom form fields on all funnel forms

Hello! I'm trying to use the API to automatically create hidden inputs in all forms. I have used the calls from /api/v2/workspaces/<workspace_id>/forms and then the one from /field_sets with the form_id but I don't quite understand this field_sets that appears to me which form of the funnels I have it refers to.

The forms response returns me "Custom Contact Attributes" and the field_sets returns "Default Field Set"

When I try to get the fields inside the field set I get a 404 error.

Thank you!

After doing several tests with the https://{subdomain}.myclickfunnels.com/api/v2/forms/field_sets/{field_set_id}/fields endpoint it seems that it always returns 404.

Using the "Try it!" button from the documentation returns 200 and an "OK" as body, but using Postman the endpoint returns a 404 error.

Thank you!

Admin(edited)

Hey Manel,

Thanks for letting us know, and I'm sorry to see that you are experiencing issues with this.

It looks like you are working your way down the Form objects correctly, but there is an issue with the routes.

We'll take care of this ASAP!

Please reach out if you have any other questions or doubts, and see you around. πŸ‘‹

Hello!

Thank you very much for the reply! I can now list the form fields.

In my case I want to be able to validate by API that in the forms of all the funnels there are hidden fields to be able to save the utms of the URL. I am planning to put a javascript to be able to move the values ​​from the url to the hidden fields of the form. But my idea was to validate through the API that all the funnels created in my workspace had these fields created and if not create them.

But I'm not sure if I'm doing it right, because when I call the fields they appear empty array and in the funnel form I have an email field.

The idea is to have that utms data in the form submission to know where the lead is coming from. If I create the hidden entries, will they appear in data.contact?

{
"id": 18821869,
"public_id": "vyvDgb",
"contact_id": 275398914,
"workspace_id": 258849,
"page_id": 12460614,
"created_at": "2024-06-17T18:22:06.086Z",
"updated_at": "2024-06-17T18:22:06.111Z",
"data": {
"contact": {
"email": "manelrocarelats+test1@gmail.com"
}
}
}


Thank you!

Admin

Hey Manel,

Thank you for sharing your use case!

But my idea was to validate through the API that all the funnels created in my workspace had these fields created and if not create them.

I think ensuring that the page data contains the hidden HTML input fields is something that you will be able to do via custom footer code JavaScript. It's not a capability that I see being solved via the Form APIs, but rather the Page API in the future.

I will double-check this information for you and give you some more details on the solution here once I have more information.

Hi Rich!

Perfect thank you for your response. I'm going to try a custom javascript

Is there any documentation on how the form that appears in the funnel works? To be able to add these custom fields by javascript. I have seen that inputs are created outside the form and then at the end of the page there is a form that I assume is the one that is called. But I don't know how to make the new fields that I put in javascript appear as custom attributes of the contact.
Thank you very much for the support!

Manel.

Admin

Hey Manel,

I've double-checked with the team, and a JavaScript piece is indeed the way to go here (assuming your UTM parameters will come from a cookie or the URL path). I'll ensure we have a JavaScript snippet we can share with you.

Hi Rich,

Perfect, thanks! I'm waiting for an example. Thanks for the support!

Manel.

ο»Ώ