1

I've created a UI form with a URLInput field. For creating new entries, it works fine. However, the 'open in new tab' setting is always checked in the edit form. The value has been binded correctly. In edit, all other fields work as expected.
enter image description here Here is my code in ui form

  <urlInput name="link">
        <settings>
            <dataType>text</dataType>
            <label translate="true">Link</label>
            <dataScope>link</dataScope>
            <isDisplayAdditionalSettings>true</isDisplayAdditionalSettings>
            <settingValue>false</settingValue>
            <urlTypes class="Magento\Ui\Model\UrlInput\LinksConfigProvider"/>
            <validation>
                <rule name="required-entry" xsi:type="boolean">false</rule>
            </validation>
        </settings>
    </urlInput>

How can I fix it?

1 Answer 1

0

Try below code:

<urlInput name="link">
    <settings>
        <dataType>text</dataType>
        <label translate="true">Link</label>
        <dataScope>link</dataScope> 
        <settingTemplate>ui/form/element/urlInput/setting</settingTemplate>
        <typeSelectorTemplate>ui/form/element/urlInput/typeSelector</typeSelectorTemplate>
        <isDisplayAdditionalSettings>true</isDisplayAdditionalSettings>
        <settingValue>false</settingValue>
        <urlTypes class="Magento\Ui\Model\UrlInput\LinksConfigProvider"/>
        <validation>
            <rule name="required-entry" xsi:type="boolean">false</rule>
        </validation>
    </settings>
</urlInput>

UPDATE:

<urlInput name="link" sortOrder="20" template="Magento_PageBuilder/form/element/url-input">
    <settings>
        <dataType>text</dataType>
        <label translate="true">Link</label>
        <dataScope>link_url</dataScope>
        <urlTypes class="Magento\Ui\Model\UrlInput\LinksConfigProvider"/>
        <isDisplayAdditionalSettings>true</isDisplayAdditionalSettings>
        <settingValue>false</settingValue>
        <urlTypes class="Magento\Ui\Model\UrlInput\LinksConfigProvider"/>
        <validation>
            <rule name="required-entry" xsi:type="boolean">false</rule>
        </validation>
    </settings>
</urlInput>
3
  • I've tried it, but it didn't work. Oct 26, 2022 at 12:12
  • Updated please try once again Oct 26, 2022 at 12:44
  • Still it is not working Oct 26, 2022 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.