Change field type from text to select

By: Steve P | Asked: 02/26/2024
ForumsCategory: Code HelpChange field type from text to select
Steve P asked 2 months ago
I'm hoping to change a field from a Text field to a Select and retain all values for this field in existing entries. We have strict formatting on the Text field so can be sure the data in existing entries will be fine.   I can see this should easy to do if I simply change the options directly in the frm_fields table, but when I do that the field doesn't change. I'm guessing there's some kind of caching happening with form fields. If that's the case, how would I flush that cache to have the form pick up my database change? Any ideas>
2 Answers
Victor Font answered 2 months ago
I would not do this if I were you. Formidable already allows you to change field types if the field types are compatible. A select and text field are not compatible types for conversion. What you may be able to do, and I have not tested this, so if you try it, do not do it in a production system. Don't try to change Formidable definition metadata in frm_fields. You are guaranteed to break something down the line if you do. Change the field association in the entry data instead. Create a new select field and change the field_id for the associated data in the frm_item_metas table.
Victor Font replied 2 months ago

I want to add one more thing. Don't try using a dynamic field for the select. Use a standard dropdown or lookup.

Steve P answered 1 month ago
Thanks Victor, I was thinking that creating a new select field and then changing the field_id might be a safer option. I'll take a look at doing that. Appreciate your advice

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