I’m trying to include a dropdown menu for changing an Entry’s Author, using Channel Form. EE 3.3.2
{exp:channel:entries channel="properties" url_title="{segment_3}"}
{exp:channel:form channel="{channel_short_name}" entry_id="{entry_id}"}
<select name="author_id">
{exp:query sql="SELECT member_id m_id, screen_name s_name FROM exp_members WHERE group_id = 1 OR group_id = 6 OR group_id = 7 ORDER BY screen_name ASC;"}
<option value="{m_id}" {if "{m_id}" == "{author_id}"}selected="selected"{/if}>{s_name}</option>
{/exp:query}
</select>
{/exp:channel:form}
{/exp:channel:entries}
But the Select dropdown contains no data (even though there are the correct number of [empty] Options output).
<option value=""></option>
Channel form seems to be limited with what data you can show directly inside the form tag, I suspect because it’s only made to show actual fields that belong to the channel and relies on the currently logged in person as the author. That’s why pulling additional data in via an embed works 😊
I’m doing a similar thing on another project and I’ve just managed to get this to work by using the EE Harbor User add-on.
{exp:channel:form channel="properties"}
<select name="author_id" id="author_id">
{exp:user:users group_id="7" orderby="screen_name" sort="asc"}
<option value="{member_id}">{screen_name}</option>
{/exp:user:users}
</select>
{/exp:channel:form}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.