Fixed <xf:numberbox> doesn't work with field-adder or Mustache

Affected version
2.0.2

DragonByte Tech

Well-known member
#1
Given the following code:
HTML:
<xf:numberbox name="cost_amount[{{ mustache('product_cost_id') }}]" value="{{ mustache('cost_amount') }}" min="0" step="any" />
Loading it produces a blank value:
1519909003746.png

HTML source:
HTML:
<div class="inputGroup inputGroup--numbers inputNumber inputGroup--joined" data-xf-init="number-box">
    <input type="number" pattern="" class="input input--number js-numberBoxTextInput" value="" min="0" step="any" required="required" name="cost_amount[509]">
    <button type="button" tabindex="-1" class="inputGroup-text inputNumber-button inputNumber-button--up"></button>
    <button type="button" tabindex="-1" class="inputGroup-text inputNumber-button inputNumber-button--down"></button>
</div>
(Line breaks added by me for readability)

The same happens if you use it via the field-adder system.

EDIT: In both cases, the + and - buttons do not have any effect until you specify a non-blank value in the input field. Credit to @Russ for reporting this in a PC as I use numberboxes extensively throughout eCommerce :)


Fillip
 
Last edited:

Chris D

XenForo developer
Staff member
#4
This is a combination of the "any" step and the blank value. It should be sorted for the next release.
 

DragonByte Tech

Well-known member
#5
This is a combination of the "any" step and the blank value. It should be sorted for the next release.
The result of {{ mustache('cost_amount') }} was 5, not blank. The blank value in the HTML source was the result of this bug.

Just wanted to clarify that in case that changes anything :)


Fillip
 
Top