Table Field Type for Formidable Forms

By: William Kudrle | Asked: 06/03/2023
ForumsCategory: Code HelpTable Field Type for Formidable Forms
William KudrleWilliam Kudrle asked 11 months ago
I am trying to be able to add a table field type to a formidable form. The goal is for someone to be able to add an editable table to the form so that they could enter values in a table structure. The use case is collecting scientific data in an experiment.  I have found an old GitHub project that does exactly what I want, but the last update was in December of 2017. I just wanted to check with the community to see if perhaps someone else (including perhaps a commercial vendor) had already done this or if there is some advice about whether it is worthwhile to try to get this old project working. I am a PHP programmer but I am new to Formidable Forms and only about a year into WordPress.  Thanks in advance for any guidance.   
Victor Font replied 11 months ago

Is the purpose of the table to add data into the table cells and have it all saved with the form entry? So if someone chooses a 4x6 table grid, you'll have 24-separate fields, one in each cell, for data collection? How do you envision this working?

William KudrleWilliam Kudrle replied 11 months ago

Yes, ideally that is how it would work. Now that Walter Jones has the Formidable Plus pretty much working again I will post more details when I get it working on my site.

3 Answers
Walter JonesWalter Jones answered 11 months ago
William, I have never seen this before.  I will take a stab at making it current.  Surprisingly it installed on my development server, but it is so old it will require a lot of coding changes.   I will let you know if I get a working product.
Victor Font answered 11 months ago

I used to use Formidable Plus back in the day. It was a useful plugin when Formidable Forms was in its toddler stage. It stopped working after awhile.

Walter JonesWalter Jones answered 11 months ago

I have resurrected Formidable Plus from the grave, Enjoy - I have made this public, if you want to add the newer field types be my guest, just fork the GIST.   

Victor Font replied 11 months ago

That is mighty generous of you, my friend! Thank you for your contribution to the community.

William KudrleWilliam Kudrle replied 11 months ago

Wow! Thanks so much for your work on this! I have downloaded your version and am trying to use it now. I am getting the following error when I try to show the Build page for my Formidable Form.

[08-Jun-2023 17:45:55 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /var/www/demolabbook/wp-content/plugins/formidable/classes/helpers/FrmFieldsHelper.php:1881
Stack trace:
#0 /var/www/demolabbook/wp-content/plugins/formidable/classes/views/frm-forms/add_field_links.php(101): FrmFieldsHelper::show_add_field_buttons()
#1 /var/www/demolabbook/wp-content/plugins/formidable/classes/views/frm-forms/edit.php(21): require('...')
#2 /var/www/demolabbook/wp-content/plugins/formidable/classes/controllers/FrmFormsController.php(1138): require('...')
#3 /var/www/demolabbook/wp-content/plugins/formidable/classes/controllers/FrmFormsController.php(143): FrmFormsController::get_edit_vars()
#4 /var/www/demolabbook/wp-content/plugins/formidable/classes/controllers/FrmFormsController.php(1760): FrmFormsController::edit()
#5 /var/www/demolabbook/wp-includes/class-wp-hook.php(308): FrmFormsController::route()
#6 /var/www/demolabbook/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#7 /var/www/demolabbook/wp-includes/plugin.php(517): WP_Hook->do_action()
#8 /var/www/demolabbook/wp-admin/admin.php(259): do_action()
#9 {main}
thrown in /var/www/demolabbook/wp-content/plugins/formidable/classes/helpers/FrmFieldsHelper.php on line 1881

When I comment out line 1881 of FrmFieldsHelper.php, then I get a bunch of errors about the icons displaying, but the Tables field icon does show up and is functional to a large extent from what I can tell.

I am pretty new to WP programming, but have been programming with PHP for quite a while. I will continue to look into this and see what I can find. Just wanted to give you a huge thank you for your work on this. This is going to be very helpful for my site. Really appreciate it.

Walter JonesWalter Jones replied 11 months ago

I’m not sure why that’s happening, did you copy and paste the support file into a code snippet as well? The one from the gist? It’s required to function properly.

William KudrleWilliam Kudrle replied 11 months ago

Yes, I installed the WP Code plugin (Lite version) and then copied code from the SUPPORT-FUNCTIONS.txt from the repo as a PHP Snippet and activated it and used the Auto Insert insert method and said to run everywhere. I tried deleting and re-installing the Formidable Plus plugin but seem to still get the same error. I haven't tried it yet in a simple installation without a lot of plugins, so that might be an issue. Tomorrow I should be able to try it with a simple WP install with just the minimal plugins and will post here what happens.

Walter JonesWalter Jones replied 11 months ago

Make sure you have Formidable Form and Formidable Forms Pro installed and uptodate. Also, I have always had more success with Code Snipetts Plugin

William KudrleWilliam Kudrle replied 10 months ago

I was able to spend some time in the debugger and came up with a simple solution that seemed to fix my issue. It was a change in the code in the ZIP file contents. In the classes/helpers/FrmPlusFieldsHelper.php I changed the add_plus_fields($fields) function to use an array for the $fields values.

$fields['table'] = array('name' => "Table", 'icon' => "frm_icon frm_upload_icon", 'message' => 'Add configurable table field to form');

I created a pull request on your repo, but this is the first WordPress PR that I have done, so hopefully it will work OK.

I am not familiar enough with WP to know if this could have been done more easily in the SUPPORT-FUNCTIONS.txt file. Please let me know if you have any suggestions for how to improve this. Thanks again for your contribution. It is very greatly appreciated.

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