Bug #23181 Bug Fixed

Cannot delete all rows from Grid field in Channel Forms using {display_fields} tag

Version: 3.5.10 Reporter: seavers

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

This is similar to the bug report in EE2.9.2:


However, it affects the {display_fields} tag rather than the {field:field_name} tag.

When using {display_fields} within the {custom_fields} tag pair, you cannot delete the last remaining row of a grid field. The field display is removed when the delete icon is pressed, and is replaced by the notice to add a row. But when saved, the field does not pass an empty array for the field/row value to the ee()->grid_lib->save() method and therefore the row is not deleted from the database.

Here’s the code (as per the documentation https://docs.expressionengine.com/latest/channel/channel_form/index.html#id71):


I can confirm that {field:field_name} tag works as it should, and you are able to delete the last remaining row.

  • Correction - cannot get it working with {field:field_name}. I’m using the following workaround:

    <link href=”{path='css/_ee_channel_form_css'}” type=”text/css” rel=”stylesheet” media=”screen”> {exp:channel:form channel=”test” entry_id=”1”}

    &lt;input name="title" type="text" value="{title}"&gt;
    &lt;label&gt;Test grid&lt;/label&gt;
    &lt;input type="hidden" value="" name="test_grid[]"&gt;
    &lt;input type="submit" value="Submit"&gt;


    Note the hidden field.

    24th July, 2017 at 4:41am
  • Thanks for the report! We’ve got it fixed up for the next release- should work in the loop and using {field:field_name}.

    For the short term, the hidden field should work fine, though if you need a patch, just let me know.

    Robin Sowell
    02nd August, 2017 at 5:26pm
  • Thanks Robin. Will {custom_fields}{display_field}{/custom_fields} also work with grids?

    03rd August, 2017 at 4:36am
  • It should- I tested with that as well.

    I went ahead and attached the updated file in the solution tab so you can try it out. If you run into any problems with it, just let me know.

    Robin Sowell
    03rd August, 2017 at 11:02am
  • Thanks Robin.

    18th August, 2017 at 6:36am
  • Backup and replace system/ee/EllisLab/Addons/channel/libraries/channel_form/Channel_form_lib.php with the one in the attached zip.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases