I tried to put # places of the url, but the url still works and e.stopImmediatePropagation () with js also didn't help. Is there any way to do this through xml or otherwise? Thanks

 <item name="buttons" xsi:type="array">
            <item name="alert_text" xsi:type="array">
                <item name="name" xsi:type="string">alert_text</item>
                <item name="label" xsi:type="string" translate="true">Custom Button</item>
                <item name="class" xsi:type="string">primary</item>
                <item name="url" xsi:type="string">*/*/url</item>

use this in a button

<item name="disabled" xsi:type="boolean">true</item>

Offical dev doc https://devdocs.magento.com/guides/v2.3/ui_comp_guide/components/ui-button.html

Ok, I got your concern. Try the below line. It adds a url but it does not work on click.

  <item name="url" xsi:type="string">'#'</item>
|improve this answer|||||
  • Padhiyar Gaurang, thanks for the answer, but this completely disable the button, I need it to be clickable simply without a link – Robinio Dec 10 '19 at 9:22
  • @RobinioTor i have updated an answer. please check. – Padhiyar Gaurang Dec 11 '19 at 6:20
  • Padhiyar Gaurang,with '#' give an error with # url works , i solved that like this jQuery('body').find('#button').removeAttr('onclick'); not a good option but so far only this has yielded result, thanks for you time – Robinio Dec 11 '19 at 8:37
  • @RobinioTor for better result use jQuery('body').find('button#alert_text').removeAttr('onclick'); – Padhiyar Gaurang Dec 11 '19 at 8:49

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.