creating your own Admin Template with 2 sub options

tenants

Well-known member
Hi there, I'm trying to create my own admin template with 2 options (on the same line, as they relate to each other)

1) a select box (greater, lesser, equal)
2) a spin box (1-x)

I've greated the correct "look", but havent figured out how to make sure the values persist

The "look" is as show here:

look.webp

my sub options I've included are here:
suboptions.webp

and the admin template is as follows:

Code:
<xen:controlunit label="{$preparedOption.title}"
hint="{$preparedOption.hint}">
    <xen:explain>{xen:raw $preparedOption.explain}</xen:explain>
    <xen:html>
        <xen:select name="{$fieldPrefix}[{$preparedOption.option_id}][operator]"  inputclass="autoSize">
            <xen:option value=">" > &gt; </xen:option>
            <xen:option value="<"> &lt; </xen:option>
            <xen:option value="="> = </xen:option>
        </xen:select>
        -
        <xen:spinbox name="{$fieldPrefix}[{$preparedOption.option_id}][value]" value="{$fieldPrefix}[{$preparedOption.option_id}][value]" inputclass="number" min="0" step="1" />
        <input type="hidden" name="{$listedFieldName}" value="{$preparedOption.option_id}" />
        {xen:raw $editLink}
    </xen:html>
</xen:controlunit>

It was just a guess, but I thought the Array Sub Options would be used in the template as:
{$fieldPrefix}[{$preparedOption.option_id}][operator] & {$preparedOption.option_id}][value] and that these would be saved out using
<input type="hidden" name="{$listedFieldName}" value="{$preparedOption.option_id}" />

I still need to add a selected statement for each of the select (operator) options, but so far just for the spin box the parameter [value] isn't persisting.

What do I need to add / do for these parameters (operator, value) to persist?
 
ahh, a simple oversight. This is what I needed to use:

<xen:controlunit label="{$preparedOption.title}"
hint="{$preparedOption.hint}">
<xen:explain>{xen:raw $preparedOption.explain}</xen:explain>
<xen:html>
<xen:select name="{$fieldPrefix}[{$preparedOption.option_id}][operator]" value="{$preparedOption.option_value.operator}" inputclass="autoSize">
<xen: option value=">" > &gt; </xen: option>
<xen: option value="<"> &lt; </xen: option>
<xen: option value="="> = </xen: option>
</xen:select>
-
<xen:spinbox name="{$fieldPrefix}[{$preparedOption.option_id}][condvalue]" value="{$preparedOption.option_value.value}" inputclass="number" min="0" step="1" />
<input type="hidden" name="{$listedFieldName}" value="{$preparedOption.option_id}" />
{xen:raw $editLink}
</xen:html>
</xen:controlunit>
 
Top Bottom