Magento 2 Field dependency in ui formmagento 2.1 How do i create form component field custom depends on another field valueMagento 2 add custom product attribute validation from install scriptMagento 2 : How can I upload files of dynamically added file input fields in the adminError Add Result page breadcrumbMagento 2.1 Create a filter in the product grid by new attributeMagento 2 Add new field to Magento_User admin formRead only field in UI component form Magento 2Error depending with fileuploader on text field validation while saving category in BOAdd an extension to edit the product name quickly in admin. Magento 2How to Update Magento 2 configurable child products price by REST APIMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?

Reversed Sudoku

Good for you! in Russian

How to draw cubes in a 3 dimensional plane

Warn me when the equation number is pushed to the next line

Does the nature of the Apocalypse in The Umbrella Academy change from the first to the last episode?

Why was Goose renamed from Chewie for the Captain Marvel film?

Should I take out a loan for a friend to invest on my behalf?

PTIJ: wiping amalek’s memory?

Is it "Vierergruppe" or "Viergruppe", or is there a distinction?

How are showroom/display vehicles prepared?

Was Luke Skywalker the leader of the Rebel forces on Hoth?

If I receive an SOS signal, what is the proper response?

When a wind turbine does not produce enough electricity how does the power company compensate for the loss?

What Happens when Passenger Refuses to Fly Boeing 737 Max?

In the quantum hamiltonian, why does kinetic energy turn into an operator while potential doesn't?

Doesn't allowing a user mode program to access kernel space memory and execute the IN and OUT instructions defeat the purpose of having CPU modes?

Motivation for Zeta Function of an Algebraic Variety

Distinction between apt-cache and dpkg -l

Find longest word in a string: are any of these algorithms good?

Why does Captain Marvel assume the people on this planet know this?

How can The Temple of Elementary Evil reliably protect itself against kinetic bombardment?

Did Carol Danvers really receive a Kree blood tranfusion?

How to write ı (i without dot) character in pgf-pie

Could you please stop shuffling the deck and play already?



Magento 2 Field dependency in ui form


magento 2.1 How do i create form component field custom depends on another field valueMagento 2 add custom product attribute validation from install scriptMagento 2 : How can I upload files of dynamically added file input fields in the adminError Add Result page breadcrumbMagento 2.1 Create a filter in the product grid by new attributeMagento 2 Add new field to Magento_User admin formRead only field in UI component form Magento 2Error depending with fileuploader on text field validation while saving category in BOAdd an extension to edit the product name quickly in admin. Magento 2How to Update Magento 2 configurable child products price by REST APIMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?













5















I have created a ui component form. I want to display some fields based on status value. Display other fields only if status is 1. How Can I achieve it?



Here is my code



<field name="status">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Status</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">status</item>
<item name="dataScope" xsi:type="string">status</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
<item name="options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="label" xsi:type="string">Pending</item>
<item name="value" xsi:type="string">0</item>
</item>
<item name="1" xsi:type="array">
<item name="label" xsi:type="string">Allowed</item>
<item name="value" xsi:type="string">1</item>
</item>
<item name="2" xsi:type="array">
<item name="label" xsi:type="string">Not Allowed</item>
<item name="value" xsi:type="string">2</item>
</item>
</item>
</item>
</argument>
</field>
<field name="title">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Title</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">textarea</item>
<item name="source" xsi:type="string">title</item>
<item name="required" xsi:type="boolean">true</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
<field name="category_ids">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">MagentoCatalogUiComponentProductFormCategoriesOptions</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Category</item>
<item name="componentType" xsi:type="string">field</item>
<item name="formElement" xsi:type="string">select</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="component" xsi:type="string">Magento_Catalog/js/components/new-category</item>
<item name="elementTmpl" xsi:type="string">ui/grid/filters/elements/ui-select</item>
<item name="filterOptions" xsi:type="boolean">true</item>
<item name="showCheckbox" xsi:type="boolean">true</item>
<item name="disableLabel" xsi:type="boolean">true</item>
<item name="multiple" xsi:type="boolean">true</item>
<item name="levelsVisibility" xsi:type="number">1</item>
<item name="required" xsi:type="boolean">false</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="listens" xsi:type="array">
<item name="$ $.namespace .$ $.namespace :responseData" xsi:type="string">setParsed</item>
</item>
</item>
</argument>
</field>
<field name="custom_field">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Custom Field</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">custom_field</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="label" xsi:type="string">No</item>
<item name="value" xsi:type="string">0</item>
</item>
<item name="1" xsi:type="array">
<item name="label" xsi:type="string">Yes</item>
<item name="value" xsi:type="string">1</item>
</item>
</item>
</item>
</argument>
</field>









share|improve this question
























  • Possible duplicate: magento.stackexchange.com/questions/132020/…

    – mp196
    Jan 9 '17 at 7:20











  • it is not working with category field and select field.

    – Jancy Abraham
    Jan 9 '17 at 9:15











  • Can you please provide the code for this file Magento_Catalog/js/components/new-category?

    – Shankar
    Feb 21 at 6:38















5















I have created a ui component form. I want to display some fields based on status value. Display other fields only if status is 1. How Can I achieve it?



Here is my code



<field name="status">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Status</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">status</item>
<item name="dataScope" xsi:type="string">status</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
<item name="options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="label" xsi:type="string">Pending</item>
<item name="value" xsi:type="string">0</item>
</item>
<item name="1" xsi:type="array">
<item name="label" xsi:type="string">Allowed</item>
<item name="value" xsi:type="string">1</item>
</item>
<item name="2" xsi:type="array">
<item name="label" xsi:type="string">Not Allowed</item>
<item name="value" xsi:type="string">2</item>
</item>
</item>
</item>
</argument>
</field>
<field name="title">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Title</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">textarea</item>
<item name="source" xsi:type="string">title</item>
<item name="required" xsi:type="boolean">true</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
<field name="category_ids">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">MagentoCatalogUiComponentProductFormCategoriesOptions</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Category</item>
<item name="componentType" xsi:type="string">field</item>
<item name="formElement" xsi:type="string">select</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="component" xsi:type="string">Magento_Catalog/js/components/new-category</item>
<item name="elementTmpl" xsi:type="string">ui/grid/filters/elements/ui-select</item>
<item name="filterOptions" xsi:type="boolean">true</item>
<item name="showCheckbox" xsi:type="boolean">true</item>
<item name="disableLabel" xsi:type="boolean">true</item>
<item name="multiple" xsi:type="boolean">true</item>
<item name="levelsVisibility" xsi:type="number">1</item>
<item name="required" xsi:type="boolean">false</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="listens" xsi:type="array">
<item name="$ $.namespace .$ $.namespace :responseData" xsi:type="string">setParsed</item>
</item>
</item>
</argument>
</field>
<field name="custom_field">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Custom Field</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">custom_field</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="label" xsi:type="string">No</item>
<item name="value" xsi:type="string">0</item>
</item>
<item name="1" xsi:type="array">
<item name="label" xsi:type="string">Yes</item>
<item name="value" xsi:type="string">1</item>
</item>
</item>
</item>
</argument>
</field>









share|improve this question
























  • Possible duplicate: magento.stackexchange.com/questions/132020/…

    – mp196
    Jan 9 '17 at 7:20











  • it is not working with category field and select field.

    – Jancy Abraham
    Jan 9 '17 at 9:15











  • Can you please provide the code for this file Magento_Catalog/js/components/new-category?

    – Shankar
    Feb 21 at 6:38













5












5








5








I have created a ui component form. I want to display some fields based on status value. Display other fields only if status is 1. How Can I achieve it?



Here is my code



<field name="status">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Status</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">status</item>
<item name="dataScope" xsi:type="string">status</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
<item name="options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="label" xsi:type="string">Pending</item>
<item name="value" xsi:type="string">0</item>
</item>
<item name="1" xsi:type="array">
<item name="label" xsi:type="string">Allowed</item>
<item name="value" xsi:type="string">1</item>
</item>
<item name="2" xsi:type="array">
<item name="label" xsi:type="string">Not Allowed</item>
<item name="value" xsi:type="string">2</item>
</item>
</item>
</item>
</argument>
</field>
<field name="title">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Title</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">textarea</item>
<item name="source" xsi:type="string">title</item>
<item name="required" xsi:type="boolean">true</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
<field name="category_ids">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">MagentoCatalogUiComponentProductFormCategoriesOptions</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Category</item>
<item name="componentType" xsi:type="string">field</item>
<item name="formElement" xsi:type="string">select</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="component" xsi:type="string">Magento_Catalog/js/components/new-category</item>
<item name="elementTmpl" xsi:type="string">ui/grid/filters/elements/ui-select</item>
<item name="filterOptions" xsi:type="boolean">true</item>
<item name="showCheckbox" xsi:type="boolean">true</item>
<item name="disableLabel" xsi:type="boolean">true</item>
<item name="multiple" xsi:type="boolean">true</item>
<item name="levelsVisibility" xsi:type="number">1</item>
<item name="required" xsi:type="boolean">false</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="listens" xsi:type="array">
<item name="$ $.namespace .$ $.namespace :responseData" xsi:type="string">setParsed</item>
</item>
</item>
</argument>
</field>
<field name="custom_field">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Custom Field</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">custom_field</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="label" xsi:type="string">No</item>
<item name="value" xsi:type="string">0</item>
</item>
<item name="1" xsi:type="array">
<item name="label" xsi:type="string">Yes</item>
<item name="value" xsi:type="string">1</item>
</item>
</item>
</item>
</argument>
</field>









share|improve this question
















I have created a ui component form. I want to display some fields based on status value. Display other fields only if status is 1. How Can I achieve it?



Here is my code



<field name="status">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Status</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">status</item>
<item name="dataScope" xsi:type="string">status</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
<item name="options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="label" xsi:type="string">Pending</item>
<item name="value" xsi:type="string">0</item>
</item>
<item name="1" xsi:type="array">
<item name="label" xsi:type="string">Allowed</item>
<item name="value" xsi:type="string">1</item>
</item>
<item name="2" xsi:type="array">
<item name="label" xsi:type="string">Not Allowed</item>
<item name="value" xsi:type="string">2</item>
</item>
</item>
</item>
</argument>
</field>
<field name="title">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Title</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">textarea</item>
<item name="source" xsi:type="string">title</item>
<item name="required" xsi:type="boolean">true</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
<field name="category_ids">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">MagentoCatalogUiComponentProductFormCategoriesOptions</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Category</item>
<item name="componentType" xsi:type="string">field</item>
<item name="formElement" xsi:type="string">select</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="component" xsi:type="string">Magento_Catalog/js/components/new-category</item>
<item name="elementTmpl" xsi:type="string">ui/grid/filters/elements/ui-select</item>
<item name="filterOptions" xsi:type="boolean">true</item>
<item name="showCheckbox" xsi:type="boolean">true</item>
<item name="disableLabel" xsi:type="boolean">true</item>
<item name="multiple" xsi:type="boolean">true</item>
<item name="levelsVisibility" xsi:type="number">1</item>
<item name="required" xsi:type="boolean">false</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="listens" xsi:type="array">
<item name="$ $.namespace .$ $.namespace :responseData" xsi:type="string">setParsed</item>
</item>
</item>
</argument>
</field>
<field name="custom_field">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Custom Field</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">custom_field</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="label" xsi:type="string">No</item>
<item name="value" xsi:type="string">0</item>
</item>
<item name="1" xsi:type="array">
<item name="label" xsi:type="string">Yes</item>
<item name="value" xsi:type="string">1</item>
</item>
</item>
</item>
</argument>
</field>






magento2 uicomponent fieldsets ui-form






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 6 mins ago









magefms

1,308224




1,308224










asked Jan 9 '17 at 7:12









Jancy AbrahamJancy Abraham

1,07611637




1,07611637












  • Possible duplicate: magento.stackexchange.com/questions/132020/…

    – mp196
    Jan 9 '17 at 7:20











  • it is not working with category field and select field.

    – Jancy Abraham
    Jan 9 '17 at 9:15











  • Can you please provide the code for this file Magento_Catalog/js/components/new-category?

    – Shankar
    Feb 21 at 6:38

















  • Possible duplicate: magento.stackexchange.com/questions/132020/…

    – mp196
    Jan 9 '17 at 7:20











  • it is not working with category field and select field.

    – Jancy Abraham
    Jan 9 '17 at 9:15











  • Can you please provide the code for this file Magento_Catalog/js/components/new-category?

    – Shankar
    Feb 21 at 6:38
















Possible duplicate: magento.stackexchange.com/questions/132020/…

– mp196
Jan 9 '17 at 7:20





Possible duplicate: magento.stackexchange.com/questions/132020/…

– mp196
Jan 9 '17 at 7:20













it is not working with category field and select field.

– Jancy Abraham
Jan 9 '17 at 9:15





it is not working with category field and select field.

– Jancy Abraham
Jan 9 '17 at 9:15













Can you please provide the code for this file Magento_Catalog/js/components/new-category?

– Shankar
Feb 21 at 6:38





Can you please provide the code for this file Magento_Catalog/js/components/new-category?

– Shankar
Feb 21 at 6:38










0






active

oldest

votes











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f153740%2fmagento-2-field-dependency-in-ui-form%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f153740%2fmagento-2-field-dependency-in-ui-form%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Nidaros erkebispedøme

Birsay

Where did Arya get these scars? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why did Arya refuse to end it?Has the pronunciation of Arya Stark's name changed?Has Arya forgiven people?Why did Arya Stark lose her vision?Why can Arya still use the faces?Has the Narrow Sea become narrower?Does Arya Stark know how to make poisons outside of the House of Black and White?Why did Nymeria leave Arya?Why did Arya not kill the Lannister soldiers she encountered in the Riverlands?What is the current canonical age of Sansa, Bran and Arya Stark?