2

So, running on 2.5.5 I would do the following (with SafeCracker instead):

{exp:channel:form channel="resumeer" return="folketinget/resume_ret/ENTRY_ID" include_jquery="no"}
    <p>Overskrift: <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100"  /></p>
     <input type="hidden" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50" />
     <input type="hidden" name="allow_comments" value="y" />
     <input type="hidden" name="relation_lovforslag" value="<?php echo $entry_id; ?>" />
     <input type="hidden" name="status" value="Closed" />
     {field:wygwam_basic}
     <p><input type="submit" name="submit" value="GEM KLADDE" class="form-submit" /></p>
{/exp:channel:form}

This is for creating a related entry to the main channel entry. The field relation_lovforslag is for that purpose and it just sends the entry_id of the main entry. However, this doesn’t work anymore and I wonder what the proper syntax is for 2.7?

3 Answers 3

1

To output the information this worked for me:

<p class="grid-row"><em>Fav Style:</em><span>{options:member_favourite_drinks}{if selected}{option_name},{/if}{/options:member_favourite_drinks}</span></p>

... and to have this in a select list:

{custom_fields}
     {if field_name=="member_favourite_drinks"}
            <select id="{field_name}" name="{field_name}[data][]" multiple="multiple">
                  <option value="">Select...</option>
                  {options}
                      <option value="{option_value}"{selected}>{option_name}</option>
                  {/options}
             </select>
     {/if}
{/custom_fields}
1
  • Yes. But I want to hardcode the choice - I want the relation to be he entry_id.
    – huulbaek
    Commented Oct 7, 2013 at 11:08
1

I ended up getting it to work with:

<input type="hidden" name="relation_lovforslag[data][]" value="<?php echo $entry_id; ?>" />

0

This works

<input type="hidden" id="relation_lovforslag" name="relation_lovforslag[][data][]" value="<?php echo $entry_id; ?>" />
1
  • I haven't tried that exact variant - I got it working eventually with: <input type="hidden" name="relation_lovforslag[data][]" value="<?php echo $entry_id; ?>" />
    – huulbaek
    Commented Nov 8, 2013 at 12:08

Your Answer

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

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