• Resolved avidkayaker908

    (@avidkayaker908)


    Hello,
    I am trying to disable the fields I dont want to use in the output of the excel file.
    when I click the x to remove the field it moves it to the disabled column but then it does not save. have tried a few versions of the app to no avail.

    Wordpress 5.71
    Gravity forms Version 2.5.0.1
    Gravity Forms Entries in Excel Version 1.8.10
    PHP 7.2
    I have 1 snippet meant to remove meta fields (dont need them) and that works fine
    I also have a field on the form that I would like to
    change the a header column name from Section ID to class1 if possible

    Thank you
    DeLoy Wilkins

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author GravityKit

    (@gravityview)

    Hi @avidkayaker908, thanks for sharing this issue. Sorry for the problems!

    Have you tried disabling other plugins except for GF Entries in Excel and Gravity Forms, then attempting to save the configuration? I ask because what you describe sounds like there might be a conflict.

    > I also have a field on the form that I would like to change the a header column name from Section ID to class1 if possible

    Please see this how-to. It requires code; if you need help with the code, please get in touch with Codeable.io.

    Thread Starter avidkayaker908

    (@avidkayaker908)

    Thank you very much for the quick feedback. Unfortunately that fix did not work. I disabled all plugins except the gravity forms and the?Entries in excel plugin and still cannot save the settings.

    On the other note the code to change labels worked perfectly!!

    I can send a json of my form if you would like as well as a list of plugins. most are part of my gravity perks paid for package.

    Regards
    DeLoy Wilkins

    Thread Starter avidkayaker908

    (@avidkayaker908)

    Hello,
    Since I cannot get the fields to save. Can you suggest a bit of code to hide said fields?
    I used the code from your direction to hide the meta fields already.
    I have some experience so just the code where I can put in my fields would be great.

    Thank you for your time!

    DeLoy Wilkins

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @avidkayaker908,

    We’ve found the problem and have fixed it. But there are some issues getting the version released. Hope this is resolved soon. In the mean time you could add something like this to you functions.php to disable a few specific fields. It’s not very scalable, but I hope you can remove it very soon ??

    add_filter('gfexcel_field_disable', function (bool $disabled, \GF_Field $field) {
        if ($field->formId == 1 && $field->id == 3){
            return true;
        }
    
        return $disabled;
    });

    This hook is called for every field, so you can prettify it how ever you like. And don’t forget to return $disabled to keep every other field working properly.

    Hope this helps you out for now. If 1.8.11 is released, you should be able to remove this code, and save the order again. Sorry for the inconvenience. This bug is part of the big GF 2.5 update ??

    Thread Starter avidkayaker908

    (@avidkayaker908)

    Thanks for the reply Doeke,
    I tried placing that code and get an error

    Error message: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed in /home/easycdlonline/public_html/forms/wp-includes/class-wp-hook.php on line 294 and exactly 2 expected in /home/easycdlonline/public_html/forms/wp-includes/functions.php:7869
    Stack trace:
    #0 /home/easycdlonline/public_html/forms/wp-includes/class-wp-hook.php(294): {closure}(false)
    #1 /home/easycdlonline/public_html/forms/wp-includes/plugin.php(212): WP_Hook->apply_filters(false, Array)
    #2 /home/easycdlonline/public_html/forms/wp-content/plugins/gravityforms/gravityforms.php(6563): apply_filters('gfexcel_field_d...', false, Object(GF_Field_HTML), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
    #3 /home/easycdlonline/public_html/forms/wp-content/plugins/gf-entries-in-excel/src/Repository/FieldsRepository.php(132): gf_apply_filters('gfexcel_field_d...', false, Object(GF_Field_HTML))
    #4 [internal function]: GFExcel\Repository\FieldsRepository::GFExcel\Repository\{closure}(Object(GF_Field_HTML))
    #5 /home/easycdlonline/public_

    Here is the code I am using form # is 3 and one field to hide is field ID 1

    add_filter('gfexcel_field_disable', function (bool $disabled, \GF_Field $field) {
        if ($field->formId == 3 && $field->id == 1){
            return true;
        }
    
        return $disabled;
    });

    any thoughts? and can I use an array to hide several fields?

    Thank You
    DeLoy Wilkins

    Plugin Author Doeke Norg

    (@doekenorg)

    Argh, thats what I get for not testing code ??

    add_filter('gfexcel_field_disable', function (bool $disabled, \GF_Field $field) {
        if ($field->formId == 3 && $field->id == 1){
            return true;
        }
    
        return $disabled;
    }, 10, 2);

    Forgot the , 10, 2 which tells the hook what the priority is (10 is default) and how many arguments it gets. 2 in our case, but it’s 1 by default. So now it should not give that error again.

    Returning true actually means the field is disabled. Hope that makes sense.

    Thread Starter avidkayaker908

    (@avidkayaker908)

    Thank you so much! Worked like a charm.
    I signed up for the PRO notification. Such a useful plug-in.
    Thanks for your time
    Now onto a great review!

    Hi

    Great plugin, any ideas when this bug fixed will get pushed?

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi sorry for the delay. We ran into some issues deploying this latest version. WordPress’ SVN system apparently isn’t ready to deal with PHP 8 code. Which is a shame, because it should be the new standard.

    Anyway, we downgraded some stuff to make WordPress happy, and I just released 1.8.12. Please let me know if this version works for you.

    Thread Starter avidkayaker908

    (@avidkayaker908)

    Thanks so much Doeke,
    New version works perfectly! kudo’s and am really looking forward to implementing.

    Kind Regards
    DeLoy Wilkins

    Thread Starter avidkayaker908

    (@avidkayaker908)

    Doeke,
    can I add more than one form id and field id in this code to replace the label? maybe an array or make it global?

    add_filter('gfexcel_field_label', function($label, GF_Field $field) {
        if ($field->formId === 3 && $field->id === 25) {
            return 'course1';
        }
    
        return $label;
    }, 10, 2);

    Kind Regards
    DeLoy Wilkins

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @avidkayaker908,

    Would you mind opening a new topic next time? That way other users can benefit as well.

    I have 2 versions for you. The first is if you are using at leasat php 7.4, which you really should ??

    add_filter('gfexcel_field_label', function ($label, \GF_Field $field) {
        // add to this array like '<table_id>.<field_id>' => 'desired value',
        $label_mapping = [
            '3.25' => 'course1',
        ];
    
        return $label_mapping[$field->formId . '.' . $field->id] ?? $label;
    }, 10, 2);

    Other wise this should do the same. It’s just a bit more code.

    add_filter('gfexcel_field_label', function ($label, \GF_Field $field) {
        // add to this array like '<table_id>.<field_id>' => 'desired value',
        $label_mapping = [
            '3.25' => 'course1',
        ];
    
        $key = $field->formId . '.' . $field->id;
    
        return isset($label_mapping[$key]) ? $label_mapping[$key] : $label;
    }, 10, 2);

    I haven’t tested it, but this should do the trick.

    Thread Starter avidkayaker908

    (@avidkayaker908)

    Thanks Doeke, works great!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Disable Fields not saving’ is closed to new replies.