XF 2.1 Nested inputs / input disabler

Lukas W.

Well-known member
Got the following markup:

Code:
<xf:checkboxrow>
    <xf:option name="my_option"
               label="My Label"
               hint="My Hint">
        <xf:select name="my_nested_select"
                   hint="My nested select hint"
                   explain="My nested select explain">
            <xf:option>Some Option</xf:option>
        </xf:select>
            <xf:html>
                <dfn class="inputChoices-explain">
                    My nested select hint
                </dfn>
            </xf:html>
        <xf:checkbox>
            <xf:option name="my_nested_checkbox"
                       value="1"
                       label="My nested checkbox"
                       hint="My nested checkbox hint">
            </xf:option>
        </xf:checkbox>
    </xf:option>
</xf:checkboxrow>

I tried to put an explain text/label onto the nested select box, but both hint and explain get ignored, so I attempted to put it in with <xf:html> manually. Unfortunately, the HTML text gets put at the very top of the nesting, above the select box, for some reason.

Hint and label on the nested checkbox work just fine.
 
There's not really a bug here, per se.

Individual select elements do not have a concept of hint or explain because they're supposed to just be standalone unless part of a full row. Checkboxes are a little different. They don't have explain support but hints make sense there.

But you can do what you want. It's worth bearing in mind that we have the <xf:dependent> tag which can be used to mix other control tags and arbitrary HTML, as well as adding clarity to which bits belong to which. So given this HTML, it should work how you want:
HTML:
<xf:checkboxrow>
   <xf:option name="my_option"
      label="My Label"
      hint="My Hint">
      <xf:dependent>
         <xf:select name="my_nested_select">
            <xf:option>Some Option</xf:option>
         </xf:select>
         <dfn class="inputChoices-explain">
            My nested select hint
         </dfn>
      </xf:dependent>
      <xf:checkbox>
         <xf:option name="my_nested_checkbox"
            value="1"
            label="My nested checkbox"
            hint="My nested checkbox hint">
         </xf:option>
      </xf:checkbox>
   </xf:option>
</xf:checkboxrow>
 
Top Bottom