The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
How to construct Field Key
The Field Key documentation says the default random key can be replaced with something else. I'd like to do that using values from other fields. Specifically, I want the key to be LastnameFirstnameMi, e.g., ThortonBillyB. How can I do that?
March 13, 2018 at 10:17 pm
That's not how a field key works or what it is used for. The field key is an alternative to the field id. It has nothing to do with the data that may be entered into a field.
The field ID is assigned by WordPress through the same process that assigns IDs to posts, pages, attachments, etc.. The field key is generated by Formidable as a random string. It may be changed to more easily identify a field in code. Field keys are unique to each field across the entire Formidable installation, regardless of how many forms you have. You cannot have two fields with the same key, nor can you assign the key dynamically. They are simply reference IDs for coding purposes.
A very common thing to do is migrate a form from one WordPress install to another. When you do this, the field ids will change based on the id assignments already established in the new WordPress instance. Field keys will not change. They remain static across WordPress instances. This is why I recommend using field keys when creating views, or writing PHP code. If you write code referencing fields with their id instead of their key, your code won't work when you migrate it to a new WordPress instance because the ids are change. When you write code referencing fields by their key, this is not a problem. The code will work after you migrate it.
March 14, 2018 at 10:37 am
Thanks.
Discussion closed.