Search code examples
comboboxadobeincrementaemdecrement

Cq5 building a number increment/decrement box


enter image description here

the above picture is what i need to build in CQ5, I have been digging around in adobe cq api, all i have found is Class CQ.Ext.form.NumberField

but that number field only provide something like textfield for you to manually entering number(this is not what i need)

can anyone guide me how to create such number increment/decrement box in cq5 dialog? with some code example please, thanks


Solution

  • You can try CQ.form.Spinner with xtype spinner. This is a trigger field for numeric, date or time values.

    The spinner uses CQ.form.Spinner.Strategy which defines its behavior.

    The dialog config snippet is shown here.

    <numfield xtype="spinner" name="./numfield" editable="false">
        <strategy xtype="number" allowDecimals="false" maxValue="50" />
    </numfield>
    

    For further info, check this Spinner API and NumberStrategy API