Posts by ursbraem

    This is a bit related to my previous post, as a fallback solution.

    Is there an example on how to add repeaters to a perch:form template?

    I would like the editors to be able to create 1-n items in the form's region in the backend.

    This would then be output as 1-n <perch:input type="checkbox"> in the form.

    I only managed static content to appear in the backend with perch:content from the form's region.

    But not the real form fields.

    The only dynamic way I found up to now is to make a select, because it accepts a comma separated list.

    1. <perch:input type="select" id="datum" required="true" label="List of events" value="wählen"
    2. options="!Please choose,<perch:content id="event_options" type="textarea" size="s" label="Events" html="false" required="true" help="Add comma separated event dates" />" />
    3. // this creates a select with multiple dates that can be entered in the backend

    But for 1-n checkboxes? has anyone done that?


    I've had this issue years ago and found a workaround, maybe today, there's a better solution?

    The idea is to dynamically populate a form with values from another region.

    I noticed the perch data option as on…variables-into-templates/

    1. $editions = perch_content_custom('Editions',$opts, true);
    2. $opts = array(
    3.     'template' => 'form.html',
    4.     'data' => [
    5.         'edition' => 'first edition'
    6. ],
    7. );
    8. perch_content_custom('Form', $opts);

    But inside the perch:form template we don't manage to render it:

    1. <perch:input id="someid" type="checkbox" value="edition" />
    2. or also:
    3. <perch:input id="edition" type="checkbox" value="edition" />

    -> This doesn't work. Is there a proper way to get a perch:form input tag that has "first edition" as value?


    The second step would be to pass in 1-n values.

    The third step to pass in 1-n key-value pairs.

    Then it would be solved.

    Any hints?

    Hi, and thanks for the example!

    Here you get two different sets. What would you do to merge the (resolved) authors directly into the news set?

    * Plug into the for each loop, render author data for each post - how to add that to the set?

    * Create two sets first and merge them manually?

    * Stick with the two sets and resolve the relation in the client, not in the data?