What is wrong with this template?

tyteen4a03

Well-known member
I can't find the error... It is throwing one at line 4 after I added xen : checked in there.

Code:
<xen:require css="3ps_usergroup_ranks_admin.css" />

<xen:checkboxunit label="{$preparedOption.title}" name="{$fieldPrefix}[{$preparedOption.option_id}]" hint="{$preparedOption.hint}">
   <xen:option name="{$fieldPrefix}[{$preparedOption.option_id}][display][posts]" label="{xen:phrase 3ps_usergroup_ranks_in_posts}" {xen:checked $preparedOption.option_value.display.posts}>
     <xen:select name="{$fieldPrefix}[{$preparedOption.option_id}][display_position][posts]" value="{$preparedOption.option_value.display_position.posts}">
       <xen:option value="0">{xen:phrase 3ps_usergroup_ranks_over_avatar}</xen:option>
       <xen:option value="1">{xen:phrase 3ps_usergroup_ranks_under_avatar}</xen:option>
       <xen:option value="2">{xen:phrase 3ps_usergroup_ranks_above_username}</xen:option>
       <xen:option value="3">{xen:phrase 3ps_usergroup_ranks_under_user_title}</xen:option>
     </xen:select>
   </xen:option>
   <xen:explain>{xen:raw $preparedOption.explain}</xen:explain>
   <xen:html>
     <input type="hidden" name="{$listedFieldName}" value="{$preparedOption.option_id}" />
     {xen:raw $editLink}
   </xen:html>
</xen:checkboxunit>
 
Can @Mike confirm that you can't use curly xen functions in xen tags? What would be the correct way of implementing this?
 
Last edited:
selected="1" or selected="0" are not valid HTML.

This is a piece of template code from my roster add-on where the values are either a 1 or a 0, and this works:

Code:
                <xen:checkboxunit label="{xen:phrase options}:">
                    <xen:option name="strict" selected="{$roster.strict}" label="{xen:phrase iwdrp_strict_group_membership}"
                        hint="{xen:phrase iwdrp_members_can_only_groups_they_belong_to}" />
                    <xen:option name="sidebar" selected="{$roster.sidebar}" label="{xen:phrase iwdrp_include_a_sidebar}"
                        hint="{xen:phrase iwdrp_include_a_sidebar_with_this_rosters_page}" />
                    <xen:option name="active" selected="{$roster.active}" label="{xen:phrase iwdrp_roster_is_active}"
                        hint="{xen:phrase iwdrp_use_this_to_temporarily_disable_this_roster}" />
                </xen:checkboxunit>

and the source that is produced:
HTML:
            <dl class="ctrlUnit">
                <dt>Options:</dt>
                <dd>
                    <ul>
<li><label for="ctrl_strict_1"><input type="checkbox" name="strict" value="1" id="ctrl_strict_1" /> Strict group membership</label> <p class="hint">Members can only view groups they belong to.</p></li>
<li><label for="ctrl_sidebar_1"><input type="checkbox" name="sidebar" value="1" id="ctrl_sidebar_1" checked="checked" /> Include a sidebar</label> <p class="hint">Include a sidebar with this roster's page.</p></li>
<li><label for="ctrl_active_1"><input type="checkbox" name="active" value="1" id="ctrl_active_1" checked="checked" /> Roster is active</label> <p class="hint">Use this to temporarily disable this roster.</p></li>
</ul>
                </dd>
            </dl>
 
This is a piece of template code from my roster add-on where the values are either a 1 or a 0, and this works:

Code:
                <xen:checkboxunit label="{xen:phrase options}:">
                    <xen:option name="strict" selected="{$roster.strict}" label="{xen:phrase iwdrp_strict_group_membership}"
                        hint="{xen:phrase iwdrp_members_can_only_groups_they_belong_to}" />
                    <xen:option name="sidebar" selected="{$roster.sidebar}" label="{xen:phrase iwdrp_include_a_sidebar}"
                        hint="{xen:phrase iwdrp_include_a_sidebar_with_this_rosters_page}" />
                    <xen:option name="active" selected="{$roster.active}" label="{xen:phrase iwdrp_roster_is_active}"
                        hint="{xen:phrase iwdrp_use_this_to_temporarily_disable_this_roster}" />
                </xen:checkboxunit>

and the source that is produced:
HTML:
            <dl class="ctrlUnit">
                <dt>Options:</dt>
                <dd>
                    <ul>
<li><label for="ctrl_strict_1"><input type="checkbox" name="strict" value="1" id="ctrl_strict_1" /> Strict group membership</label> <p class="hint">Members can only view groups they belong to.</p></li>
<li><label for="ctrl_sidebar_1"><input type="checkbox" name="sidebar" value="1" id="ctrl_sidebar_1" checked="checked" /> Include a sidebar</label> <p class="hint">Include a sidebar with this roster's page.</p></li>
<li><label for="ctrl_active_1"><input type="checkbox" name="active" value="1" id="ctrl_active_1" checked="checked" /> Roster is active</label> <p class="hint">Use this to temporarily disable this roster.</p></li>
</ul>
                </dd>
            </dl>
HTML as shown in Inspect Elements or View Source Code?
 
Top Bottom