Fixed Input disabler with event `desc-loader` does not applied

Affected version
2.0.12

truonglv

Formerly Nobita.Kun
Hello. I have setup this template and use desc-loader:

HTML:
<div>{{ phrase('tlc_apply_credits_to...') }}</div>
<xf:radio name="{$inputName}[apply_credits]" value="{$options.apply_credits}">
    <xf:option value="uploader">{{ phrase('tlc_resource_uploader') }}</xf:option>
    <xf:option value="downloader" label="{{ phrase('tlc_downloader') }}">
        <xf:checkbox>
            <xf:option name="{$inputName}[require_credits]"
                       label="{{ phrase('tlc_require_credits_for_downloading') }}"
                       selected="{$options.require_credits}"
                       hint="{{ phrase('tlc_require_credits_for_downloading_explain') }}"/>
        </xf:checkbox>
    </xf:option>
</xf:radio>
The apply_credits value to uploader.

Expected: The input require_credits should be disabled.
Actual: It's not disabled
 

DragonByte Tech

Well-known member
You’re missing <xf:dependent> inside the option tag. On mobile so copy pasting is difficult but just wrap the xf:checkbox in that tag and you’ll find it works :)
 

DragonByte Tech

Well-known member
I couldn’t say, all I know is that every time I have used a disabler like that, I’ve wrapped the contents in the dependent tag and I’ve not had an issue yet :)
 

Chris D

XenForo developer
Staff member
This report confuses me somewhat.

Firstly, desc-loader is mentioned, but then I'm not sure how that's relevant and that doesn't seem to be used in the example code.

Further from that, the actual code does seem to work for me, without any additional markup.

Taking what you have said literally, you're saying that if the radio has a value of uploader then the require_credits checkbox is not disabled.

This is the code I am testing with:
HTML:
<div>{{ phrase('tlc_apply_credits_to...') }}</div>
<xf:radio name="{$inputName}[apply_credits]" value="uploader">
   <xf:option value="uploader">{{ phrase('tlc_resource_uploader') }}</xf:option>
   <xf:option value="downloader" label="{{ phrase('tlc_downloader') }}">
      <xf:checkbox>
         <xf:option name="{$inputName}[require_credits]"
            label="{{ phrase('tlc_require_credits_for_downloading') }}"
            selected="{$options.require_credits}"
            hint="{{ phrase('tlc_require_credits_for_downloading_explain') }}"/>
      </xf:checkbox>
   </xf:option>
</xf:radio>
And that gives me the expected results:

196573

Are you still struggling with this? How was desc-loader relevant? Are we missing anything?
 

Chris D

XenForo developer
Staff member
I think we’d really need to see your exact use case and full code if it is reproducible.

Ideally shared with us as an add-on or a reduced add-on that contains just the problematic bit.
 

Chris D

XenForo developer
Staff member
Thanks.

I'll be honest. I was half tempted to mark this as designed/won't fix.

You're essentially using the desc-loader for something that it wasn't designed to do. Its only purpose has always been to load simple text descriptions (like code event descriptions).

It really isn't designed to be loading in additional form elements and other dynamic content. In fact, using it for that just isn't semantically correct.

That said, I've fixed it so I guess I'm just typing for no reason 🤷‍♂️
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.1).

Change log:
When inserting the description received by XF.DescLoader.onLoad run it through XF.setupHtmlInsert to ensure the resulting HTML is activated and any new JS is initialized.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top