是否可以在SafeCracker表单中使用author下拉选择字段,就像使用下面的代码创建Status下拉选择字段一样?
{status_menu}
<label for="status">Status</label>
<select name="status" id="status">
{select_options}
</select>
{/status_menu}我已经搜索了文档和EE论坛,但没有找到任何东西,但希望有一种方法来做到这一点。
谢谢你的帮助
Ste
编辑:
感谢Tyssen在下面的回复,我刚刚在一个SafeCracker表单中实现了这个解决方案,它工作得很好。不过需要注意的是,这个名字应该是author_id,而不是author。下面是我的最后一段代码,包括一个显示条目当前作者的条件:
<label>Author</label>
<select name="author_id">
{exp:query sql="SELECT member_id, screen_name, group_id FROM exp_members ORDER BY screen_name ASC;"}
<option value="{member_id}" {if "{member_id}" == "{author_id}"}selected="selected"{/if}>{screen_name}</option>
{/exp:query}
</select>发布于 2012-11-16 13:42:27
也许可以使用查询模块?
<select name="author">
{exp:query sql="SELECT member_id, screen_name
FROM exp_members
WHERE group_id = X;"
}
<option value="{member_id}">{screen_name}</option>
{/exp:query}https://stackoverflow.com/questions/13410372
复制相似问题