4

Is there a way to add note with link to form ui component. I have try the below code but it doesn't work

<field name="customer_id">
<argument name="data" xsi:type="array">
    <item name="options" xsi:type="object">Company\Module\Model\Config\Source\Customer</item>
    <item name="config" xsi:type="array">
        <item name="label" xsi:type="string" translate="true">Customer</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">customer_id</item>
        <item name="dataScope" xsi:type="string">customer_id</item>
        <item name="notice" xsi:type="string"><![CDATA[<a href="customer/index/new" target="_blank">Create New Customer</a>]]></item>
        <item name="validation" xsi:type="array">
            <item name="required-entry" xsi:type="boolean">true</item>
        </item>
    </item>
</argument>
</field>

Also I checked the tooltip. But the new customer link doesn't work(It works with ext).

<field name="customer_id">
<argument name="data" xsi:type="array">
    <item name="options" xsi:type="object">Company\Module\Model\Config\Source\Customer</item>
    <item name="config" xsi:type="array">
        <item name="label" xsi:type="string" translate="true">Customer</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">customer_id</item>
        <item name="dataScope" xsi:type="string">customer_id</item>
        <item name="tooltip" xsi:type="array">
            <item name="link" xsi:type="string" translate="true">customer/index/new</item>
            <item name="description" xsi:type="string">Create New Customer</item>
        </item>
        <item name="validation" xsi:type="array">
            <item name="required-entry" xsi:type="boolean">true</item>
        </item>
    </item>
</argument>
</field>

Please help.

1 Answer 1

1
<field name="customer_id">
<argument name="data" xsi:type="array">
    <item name="options" xsi:type="object">Company\Module\Model\Config\Source\Customer</item>
    <item name="config" xsi:type="array">
        <item name="label" xsi:type="string" translate="true">Customer</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">customer_id</item>
        <item name="dataScope" xsi:type="string">customer_id</item>
        <item name="tooltip" xsi:type="array">
            <item name="link" xsi:type="string">{{baseUrl}}customer/index/new</item>
            <item name="description" xsi:type="string">Create New Customer</item>
        </item>
        <item name="validation" xsi:type="array">
            <item name="required-entry" xsi:type="boolean">true</item>
        </item>
    </item>
</argument>
</field>

You have pass full url as link in your xml file and check.

<item name="link" xsi:type="string">{{baseUrl}}customer/index/new</item>
13
  • Thanks for your reply. Iam creating an extension. So can't set full url as link. Dec 22, 2016 at 6:21
  • Please check updated answer. Dec 22, 2016 at 6:28
  • It is not working. It just reload the current page. Dec 22, 2016 at 6:34
  • have you created customer/index/new action, first have you checked its working or not Dec 22, 2016 at 6:37
  • just set {{baseUrl}}customer/index/new Dec 22, 2016 at 6:41

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.