0

I'm looking to render a list of channel forms of the same page. So something like this:

{exp:channel:entries
    channel="my_channel"
    limit="5"
}
    {exp:channel:form
        entry_id="{entry_id}"
    }
        <input type="text" name="custom_field" value="{my_value}">
        <button type="submit">GO!</button>
    {/exp:channel:form}
{/exp:channel:entries}

This does show the forms but I can only submit the first one because all the form tokens are the same and as soon as it has been used, it can't be used again.

Also, it's very heavy to load.

Even more ideal would be to have one submit button and one form wrapping all entries.

0

If you only want to have a single form that covers all entries you could use Stash to save all your entry IDs to a variable which you then use in the entry_id parameter of the form, e.g.

{exp:stash:set 
  name="form_ids" 
  parse_tags="yes"
}{exp:channel:entries}{entry_id}|{/exp:channel:entries}{/exp:stash:set}

{exp:stash:parse process="end"}
  {exp:channel:form
    entry_id="{exp:stash:get name='form_ids'}"
  }
    <input type="text" name="custom_field" value="{my_value}">
    <button type="submit">GO!</button>
  {/exp:channel:form}
{/exp:stash:parse}

A bit more info in Stash category ID and entries

| improve this answer | |
  • There are two issues with this code. First this code does not work. It give me the error "You must specify a valid entry to edit." Second, it doesn't do what I want to accomplish because it does not loop over the different entries. Lets say I want to render a html table to set a different price of an item on every row. Every row contains an input field for a specific custom field 'price'. Every row should correspond to a different entry_id. However one submit button should submit all the different price values to each channel entry. – Louis K Oct 10 '17 at 10:49

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.