0

I have a channel form with a lot of fields, so many in fact, I am about to max out the field group's limit. I would like to use the Grid field to reduce the actual number of custom fields in the group.

Here is the current code I am using to capture input on the form:

{exp:channel:form channel="name" class="order" return="liners/confirmation" }
<table class="fourteen-col">        
    <tbody>
    <tr>
        <td class="plant_name">Azalea Native</td>
        <td>$2.25</td>
        <td>$2.00</td>
        <td>$1.75</td>
        <td>$1.50</td>
        <td>$0.70</td>
        <td>$0.85</td>
        <td>$1.00</td>
        <td><input type="text" name="az_native_1g_spr" value=""/></td>
        <td><input type="text" name="az_native_2g_spr" value=""/></td>
        <td><input type="text" name="az_native_series_3g_spr" value=""/></td>
        <td><input type="text" name="az_native_series_1g_fall" value=""/></td>
        <td><input type="text" name="az_native_series_2g_fall" value=""/></td>
        <td><input type="text" name="az_native_series_3g_fall" value=""/></td>
    </tr>

</tbody>
</table>
<input type="submit" name="submit" value="Submit">
{/exp:channel:form}

I just need some guidance on how to integrate the Grid field values which are like this:

Grid field name: grid_name

Grid column names: 1_gal_spr, 2_gal_spr, 3_gal_spr, 1_gal_fall, 2_gal_fall, 3_gal_fall

I would normally use {grid_name:1_gal_spr} to reference that information, but when I include the curly brackets in the form it throws an error.

What is the correct way to do this?

0

This looks to be a duplicate of this : Adding New Grid Entries With Channel:Form

Also, someone else has asked a virtually identical question just now here : Add New Grid Rows via Channel Form

(you can use the same logic while switching Matrix with Grid, Or Channel form with SafeCracker Form)

Check out that question and my answer, it basically deals with what you're asking.

In short what you need to do is make sure you have the previously set rows in the Channel form as hidden elements. When you sumbit the channel entry form it takes your grid/matrix values in their entirety and saved them as the field value, it does not append them. So as you see, you will need to add the existing values to the form, then add your new values, and submit the whole lot!

There is also a simplier way, you can usethe field tag syntax to get the matrix onto your form. See this post (which I based my previous answers on) : How to work with the new channel forms and the new grid fieldtype ( and updateing it)

Basically use {field:your_grid_fieldname}...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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