0

we are trying to create an admin UI From with Html content with Field Set, Html Content input fields are posted.

what I did:

Vendor/Module/view/adminhtml/ui_component/page_master_add_form.xml

<fieldset name="campaignpages">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="collapsible" xsi:type="boolean">false</item>
                <item name="label" xsi:type="string" translate="true">Add New Page</item>
            </item>
        </argument>
       <field name="cam_code">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string" translate="true"> Code</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="source" xsi:type="string">pages</item>
                    <item name="validation" xsi:type="array">
                        <item name="required-entry" xsi:type="boolean">false</item>
                    </item>
                </item>
            </argument>
        </field>
        <container name="lead_service_section">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="sortOrder" xsi:type="number">40</item>
                </item>
            </argument>
            <htmlContent name="html_content">
                <argument name="block" xsi:type="object">Vendor\Module\Block\Adminhtml\Campaign\Edit\Services\ServicesData</argument>
            </htmlContent>
        </container>
        <field name="cam_name">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string" translate="true">Name</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="source" xsi:type="string">pages</item>
                    <item name="validation" xsi:type="array">
                        <item name="required-entry" xsi:type="boolean">false</item>
                    </item>
                </item>
            </argument>
        </field>
</fieldset>

Find My Block File :

Vendor\Module\Block\Adminhtml\Pages\Edit\Services\ServicesData

class ServicesData extends \Magento\Backend\Block\Template
{
    /**
     * Block template.
     *
     * @var string
     */
    protected $_template = 'Vendor_module::service/servicesdata.phtml';


    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        array $data = []
    ) {
        parent::__construct($context, $data);
    }
}

Template File:

Vendor/Module/view/adminhtml/templates/service/servicesdata.phtml

<div class="services">
        <div class="add_services">
            <button type="button" id="add_service"> + Add Services</button>
        </div>
        <div class="new_services">
            <div class="admin__field-control" id="add_new_services">
                <div class="services" data-sku="">
                    <table class="admin__field-control admin__control-table" id="attribute-labels-table">
                        <thead>
                            <tr>
                                <th class="col-store-view"><?= $block->escapeHtml(__('SP Code')); ?></th>
                                <th class="col-store-view"><?= $block->escapeHtml(__('Action')); ?></th>
                                <th class="col-store-view"><?= $block->escapeHtml(__("")); ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td class="col-store-view">
                                    <input data-form-part="page_master_add_form" type="text" name="spcodes" class="admin__control-text input-text required-option" value="10000">
                                </td>
                                <td class="col-store-view">
                                    <button type="button" class="get_services_data">Submit</button>
                                </td>
                                <td class="col-store-view">
                                    <button type="button" class="get_services_data">Remove</button>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>

        </div>
    </div>

In that form render correctly, But while post the form, its not only post the HTML content input fields.

Let me know, what did wrong.

Reference:

enter image description here

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.