1

Basically, want to add javascript code in code in-

../view/layout/vendor_module_request_edit.xml or ../view/adminhtml/ui_component/venor_module_request.xml

or we if possible want to add a separate .phtml or .JS

In any of this file so when my UI_component form loaded with a certain script any suggestion please share.

this is my venor_module_request.xml file code

<?xml version="1.0" ?>

    <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
        <argument name="data" xsi:type="array">
            <item name="js_config" xsi:type="array">
                <item name="provider" xsi:type="string">Vendor_module_name_request_form.request_form_data_source</item>
            </item>
            <item name="label" translate="true" xsi:type="string">General Information</item>
            <item name="template" xsi:type="string">templates/form/collapsible</item>
        </argument>
        <settings>
            <buttons>
                <button class="Vendor\module_name\Block\Adminhtml\Request\Edit\BackButton" name="back"/>
                <button class="Vendor\module_name\Block\Adminhtml\Request\Edit\DeleteButton" name="delete"/>
                <button class="Vendor\module_name\Block\Adminhtml\Request\Edit\SaveButton" name="save"/>
                <button class="Vendor\module_name\Block\Adminhtml\Request\Edit\SaveAndContinueButton" name="save_and_continue"/>
            </buttons>
            <namespace>Vendor_module_name_request_form</namespace>
            <dataScope>data</dataScope>
            <deps>
                <dep>Vendor_module_name_request_form.request_form_data_source</dep>
            </deps>
        </settings>
        <dataSource name="request_form_data_source">
            <argument name="data" xsi:type="array">
                <item name="js_config" xsi:type="array">
                    <item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
                </item>
            </argument>
            <settings>
                <submitUrl path="*/*/save"/>
            </settings>
            <dataProvider class="Vendor\module_name\Model\Request\DataProvider" name="request_form_data_source">
                <settings>
                    <requestFieldName>id</requestFieldName>
                    <primaryFieldName>id</primaryFieldName>
                </settings>
            </dataProvider>
        </dataSource>


        <fieldset name="general">
            <settings>
                <label>Generals Information</label>
            </settings>
            <field name="status" formElement="select">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="source" xsi:type="string">status</item>
                        <item name="additionalClasses" xsi:type="array">
                            <item name="pi_status" xsi:type="boolean">true</item>
                        </item> 
                    </item>
                </argument>
                <settings>
                    <dataType>text</dataType>
                    <label translate="true">Status</label>
                    <dataScope>status</dataScope>
                </settings>
                <formElements>
                    <select>
                        <settings>
                            <options class="Magento\Config\Model\Config\Source\Yesno"/>
                        </settings>
                    </select>
                </formElements>
            </field>
        </fieldset> 
    </form>
2

0

Your Answer

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

Browse other questions tagged or ask your own question.