i want to set required on input field in ui_component form. below is my form field code
<field name="title"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string">Some text</item> <item name="visible" xsi:type="boolean">true</item> <item name="dataType" xsi:type="string">text</item> <item name="formElement" xsi:type="string">input</item> <item name="source" xsi:type="string">sampleform</item> </item> </argument> </field>
thanks in advance..
Solved! Go to Solution.
after many search i find solution i was missing
<item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">true</item> </item>
after that complete code for input field
<field name="title"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string">Some text</item> <item name="visible" xsi:type="boolean">true</item> <item name="dataType" xsi:type="string">text</item> <item name="formElement" xsi:type="string">input</item> <item name="source" xsi:type="string">sampleform</item> <item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">true</item> </item> </item> </argument> </field>
after many search i find solution i was missing
<item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">true</item> </item>
after that complete code for input field
<field name="title"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string">Some text</item> <item name="visible" xsi:type="boolean">true</item> <item name="dataType" xsi:type="string">text</item> <item name="formElement" xsi:type="string">input</item> <item name="source" xsi:type="string">sampleform</item> <item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">true</item> </item> </item> </argument> </field>