• Resolved p3k074

    (@p3k074)


    Hello,

    I am using your plugin to export entries from Gravity Forms, and I’ve encountered an issue with handling empty dropdown fields. Specifically, I have a dropdown field with one selectable option that has the value YES. If the field is not selected, it remains empty. However, during the export process, it seems that empty dropdown fields are completely skipped, and the gfexcel_field_value hook is not triggered for these fields.

    This behavior makes it impossible to assign a default value (e.g., 0) to such fields during export. Is there a way to ensure that empty dropdown fields are included in the export and processed by the available hooks? Alternatively, is there another hook or method I could use to modify the exported data to assign default values to these empty fields?

    Thank you in advance for your guidance!

    Best regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Doeke Norg

    (@doekenorg)

    Hi @p3k074,

    You’re right. The hook does not get called. And I’m not sure it must be called with an empty value. But I think we can add a specific hook in case someone want to return a value in case of missing values. Because that is the issue; from “all” the input options (in your case just one), it checks if that is available on the entry. So I will add a hook that gets triggered if no checkbox is selected; so you can return a preferred value. I’ll let you know as soon as this hook is released.

    Kind regards,

    Doeke

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @p3k074

    I’ve just pushed version 2.3.6 that includes a new hook to set a default value for empty checkboxes.

    You can use it like this:

    add_filter( 'gfexcel_field_checkbox_empty', function (): string {
    	return 'Empty value';
    } );

    Optionally the hook receives 3 parameters:
    1. The empty value (this is '' by default).
    2. The entry object
    3. The original Gravity Forms Field object

    As usual you can also call the hook with an additional form ID and field ID to be extra specific:

    gfexcel_field_checkbox_empty_12 or gfexcel_field_checkbox_empty_12_5 to target respectively form 12, or field 5 on form 12.

    I hope this helps you out.

    Kind regards,

    Doeke

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.