Duplicate view to a different form

By: Steve P | Asked: 07/19/2023
ForumsCategory: How-toDuplicate view to a different form
Steve P asked 9 months ago
I'm looking to duplicate a form and it's associated views. The option to duplicate a view will just associate that duplicate to the original form. There doesn't appear to be a way to assign that view to a different form (my duplicated form). Am I missing something here? Is it possible via the Formidable UI? I can see in the database that the view is a post and has a 'frm_form_id' meta value that associates it with a form. I'm guessing I can just change this to the new form ID. That should be ok shouldn't it?
1 Answers
Victor Font answered 9 months ago
You would have to change a lot more than just form_id. Formidable views are custom post types with the "frm_display" post_type. Because WordPress is a metadta schema, it means that a view's content is spread across wp_posts and wp_postmeta. You would have to change every reference to ids or keys for the form and its fields in the view. Some of the fields you are changing are serialized arrays, which means you have to be incredibly precise in changing the string content and their lengths. Nobody that I know of will support you duplicating a view manually. It's a lot of effort and there's much to much that can go wrong if you make even the slightest mistake. It would be much easier to create a new view and copy the content you want into the new view. Keep in mind duplicate keys and ids are not permitted. For more information about writing transportable code, please see this: https://formidable-masterminds.com/writing-transportable-code-keys-vs-ids/

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community