1

I've got a channel form which contains a grid field and I can add and edit content with no issues. The problem however is that if I remove an entire row, and then save the edit, nothing is updated. I'm returned to the entry and the row remains.

{exp:channel:form channel="content" return="URL_TITLE" entry_id="{segment_3}" require_entry="yes"}

    <h1>Edit: {title}</h1>
    <input type="hidden" name="structure_uri" value="{url_title}">
    <input type="hidden" name="structure_template_id" value="36">
    <input type="hidden" name="structure_parent_id" value="0">

    <input type="text" name="title" value="{title}">

    <div id="section1" class="form-container">
       <h2>Section #1</h2>
       {field:section_1}
       <a href="#" class="add_attachment">Add Attachments?</a>
       <div class="attachments">
          <h3>Section #1 Attachments</h3>
          {field:section_1_files}
       </div>
    </div>

    <input type="submit" id="save" value="Save Changes">

{/exp:channel:form}

Both {field:section_1} and {field:section_1_files} are the grid fields. Once I remove a row it disappears from the page and is replaced with the;

"You have not added any rows of data yet. Add some data?"

But saving doesn't appear to be doing anything.

Any help would be great

Thank you.

1 Answer 1

0

This turned out to be a bug that EllisLab have provided a solution for.

Add the following line to the beginning of system/expressionengine/fieldtypes/grid/views/publish.php:

<input type="hidden" name="<?=$field_id?>" value="placeholder"/> 

Here is the source link: https://support.ellislab.com/bugs/detail/20718

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.