0

I need to disable the input field when customergroup = 0 or 1 and quantity is < 0 but when I add the argument 'disabled' to the input, the add2cart button does not put the other available items in the cart anymore.

   <input type="number"
                                       name="super_group[<?= $block->escapeHtmlAttr($_item->getId()) ?>]"
                                       data-selector="super_group[<?= $block->escapeHtmlAttr($_item->getId()) ?>]"
                                       value="<?= $block->escapeHtmlAttr($_item->getQty() * 1) ?>"
                                       title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
                                       class="input-text qty"
                                       min="0"
                                       data-validate="{'validate-grouped-qty':'#super-product-table'}"
                                       data-errors-message-box="#validation-message-box"
                                    <?php if ($disable_box === '1'  && ($block->getStockStatus($_item) == '1' || $block->getStockStatus($_item) == '0' )) {echo 'disabled';} ?> />
                            </div>

disabled inputboxes

2 Answers 2

0

The element with attribute disabled will not pass the value to form.

You can use readonly attribute instead of disabled or render additional element like <input type=hidded.../> for pass 0 value.

0

I have notice that, I have resolved it now like this:

  {echo 'readonly style="background-color:#D3D3D3;border-color:#D3D3D3;"';} ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.