I have a field which i don’t want to show. But this field needs to be required.
this field should be populated when we click on specific button via ajax.
so we have something like that:
<form>
......
......
<fieldset>
<field name="myfield" formElement="textarea" sortOrder="120">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Source</item>
<item name="visible" xsi:type="boolean">false</item>
<item name="disabled" xsi:type="boolean">true</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">My field</label>
<dataScope>myfield</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
</settings>
</field>
</fieldset>
<htmlContent name="html_content">
<block name="html_content_block" class="NamespaceModuleBlockAdminhtmlMyblock">
<arguments>
<argument name="template" xsi:type="string">Namespace_Module::template.phtml</argument>
</arguments>
</block>
</htmlContent>
</form>
html element is used to add button we need and javascript which contains ajax call.
This part does work as intended, however user can ignore this part and click on save button which leaves that field empty.
any idea on how to solve this ?