{"id":11962,"date":"2020-09-28T13:36:18","date_gmt":"2020-09-28T08:06:18","guid":{"rendered":"https:\/\/www.hiddentechies.com\/blog\/?p=11962"},"modified":"2021-01-16T16:00:44","modified_gmt":"2021-01-16T10:30:44","slug":"add-hidden-field-ui-component-form-magento-2","status":"publish","type":"post","link":"https:\/\/www.hiddentechies.com\/blog\/magento-2\/add-hidden-field-ui-component-form-magento-2\/","title":{"rendered":"How to Add Hidden Field in ui_component Form in Magento 2"},"content":{"rendered":"<p>In this post I am going to explain how to add hidden field in ui_component form in Magento 2.<\/p>\n<p>Check the below example code snippet to add hidden field in <strong>ui_component<\/strong>.<\/p>\n<pre class=\"lang:default decode:true \">&lt;field name=\"id\" formElement=\"hidden\"&gt;\r\n    &lt;argument name=\"data\" xsi:type=\"array\"&gt;\r\n        &lt;item name=\"config\" xsi:type=\"array\"&gt;\r\n            &lt;item name=\"dataType\" xsi:type=\"string\"&gt;text&lt;\/item&gt;\r\n        &lt;\/item&gt;\r\n    &lt;\/argument&gt;\r\n&lt;\/field&gt;<\/pre>\n<p>Here <strong>formElement=&#8221;hidden&#8221;<\/strong> is used to create a hidden field.<\/p>\n<p>If you want to check the UI component field then you can check it in Browser Console as its not visible in the form.<\/p>\n<p>Thats it. Enjoy Magento 2!!<\/p>\n<div class=\"angwp_12010 _ning_cont _ning_hidden _ning_outer _align_center responsive\" data-size=\"custom\" data-bid=\"12010\" data-aid=\"0\" style=\"max-width:800px; width:100%;height:inherit;\"><div class=\"_ning_label _left\" style=\"\"><\/div><div class=\"_ning_inner\" style=\"\"><a href=\"https:\/\/www.hiddentechies.com\/blog?_dnlink=12010&t=1778960177\" class=\"strack_cli _ning_link\" target=\"_blank\">&nbsp;<\/a><div class=\"_ning_elmt\"><img decoding=\"async\" src=\"https:\/\/www.hiddentechies.com\/blog\/wp-content\/uploads\/angwp\/items\/12010\/Banner-2.png\" \/><\/div><\/div><\/div><div class=\"clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>In this post I am going to explain how to add hidden field in ui_component form in Magento 2. Check the below example code snippet to add hidden field in ui_component. &lt;field name=&#8221;id&#8221; formElement=&#8221;hidden&#8221;&gt; &lt;argument name=&#8221;data&#8221; xsi:type=&#8221;array&#8221;&gt; &lt;item name=&#8221;config&#8221; xsi:type=&#8221;array&#8221;&gt; &lt;item name=&#8221;dataType&#8221; xsi:type=&#8221;string&#8221;&gt;text&lt;\/item&gt; &lt;\/item&gt; &lt;\/argument&gt; &lt;\/field&gt; Here formElement=&#8221;hidden&#8221; is used to create a hidden field&#8230;. <\/p>\n<div class=\"actions\"><a href=\"https:\/\/www.hiddentechies.com\/blog\/magento-2\/add-hidden-field-ui-component-form-magento-2\/\">Continue Reading<\/a><\/div>\n","protected":false},"author":1,"featured_media":12271,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[181,59,2138],"tags":[729,9,10,2153],"_links":{"self":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/11962"}],"collection":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/comments?post=11962"}],"version-history":[{"count":1,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/11962\/revisions"}],"predecessor-version":[{"id":11963,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/11962\/revisions\/11963"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media\/12271"}],"wp:attachment":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media?parent=11962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/categories?post=11962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/tags?post=11962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}