kadence-blocks icon indicating copy to clipboard operation
kadence-blocks copied to clipboard

[Feature] configurable name tags for form fields

Open superewald opened this issue 2 years ago • 3 comments

summary

Currently the form fields are assigned random name tags like kb_field__45e1c6-bc_3 and it seems there is no intended way to override the field names (I'm using the free version, maybe it's a pro feature?).

I'm aware there's the webhook action but (at least from what I can see) that wouldn't solve this specific problem as the field name would still be auto-generated (that's just a guess, as I said I don't have the pro version).

use case

I want to send the form data to a rest endpoint using json which is quite easy to implement. However, my API endpoint expects the data in the simple form of

{
    "<name>": "<value>"
}

I think this use case is simple enough to be supported from this plugin.

proposal

Provide the possibility to override name field wise (inside gutenberg).

superewald avatar Mar 19 '22 17:03 superewald

Just a note with Kadence Blocks Pro and the built in webhook functions you can map your fields so you can set the send id.

kadencewp avatar Mar 23 '22 02:03 kadencewp

Just a note with Kadence Blocks Pro and the built in webhook functions you can map your fields so you can set the send id.

I already thought that would be the case as I've done it the same way using hooks. The question is wether there is a good reason to use those auto-generated id's instead of user defined ones ? Would make form handling way easier from a developer perspective in my opinion.

If you don't mind I would create a PR for this but if it's intended to be like this (to motivate people buying the pro version for eg) just close the issue :)

superewald avatar Mar 25 '22 11:03 superewald

I've updated the issue as I mixed up form field IDs and names. Also included a PR to solve this issue.

superewald avatar Mar 26 '22 17:03 superewald