How can I add an event when changes select box dropdown value and I will trigger Ajax when change value in the dropdown,
Below is my code.
<fieldset name="sample_fieldset">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Attribute Information</item>
</item>
</argument>
<field name="attr">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">vendor\module\Model\Source\option</item>
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Select Attribute</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">splitattr</item>
<item name="dataScope" xsi:type="string">attr</item>
<item name="default" xsi:type="string">0</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>Below is the output which created
How can I get selected value in jquery
Hi @Pushpendra7 ,
Please check below url for adding ui component custom js and you can get the selected value and call ajax.
https://magento.stackexchange.com/questions/153740/magento-2-field-dependency-in-ui-form
Hope this helps you!
Problem Solved! Click Kudos & Accept as Solution!