1

I have multiselectin my form displaying all store view available one is selected when I save only one show in the post array:

enter image description here

enter image description here

<field name="store">
    <argument name="data" xsi:type="array">
        <item name="options" xsi:type="object">Magento\Store\Model\ResourceModel\Store\Collection</item>
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string" translate="true">Store</item>
            <item name="visible" xsi:type="boolean">true</item>
            <item name="dataType" xsi:type="string">number</item>
            <item name="formElement" xsi:type="string">multiselect</item>
            <item name="source" xsi:type="string">store</item>
            <item name="multiple" xsi:type="boolean">true</item>
            <item name="dataScope" xsi:type="string">store</item>
            <item name="valueMap" xsi:type="array">
                <item name="true" xsi:type="number">1</item>
                <item name="false" xsi:type="number">0</item>
            </item>
            <item name="default" xsi:type="number">0</item>
        </item>
    </argument>
</field>

Is there anyway I can make all available options to go with post with the value of 0 ?

  • I think you need to pass all ids not only value 0 – magefms Apr 4 at 10:26
0

Maybe try passing all the store ids in your multiselect default value

<field name="store">
    <argument name="data" xsi:type="array">
        <item name="options" xsi:type="object">Magento\Store\Model\ResourceModel\Store\Collection</item>
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string" translate="true">Store</item>
            <item name="visible" xsi:type="boolean">true</item>
            <item name="dataType" xsi:type="string">number</item>
            <item name="formElement" xsi:type="string">multiselect</item>
            <item name="source" xsi:type="string">store</item>
            <item name="multiple" xsi:type="boolean">true</item>
            <item name="dataScope" xsi:type="string">store</item>
            <item name="valueMap" xsi:type="array">
                <item name="true" xsi:type="number">1</item>
                <item name="false" xsi:type="number">0</item>
            </item>
            <item name="default" xsi:type="string">1,2,3</item>
        </item>
    </argument>
</field>
  • I've already tried that but no luck. – Juliano Vargas Apr 4 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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