Question

I am able to add custom tab customer edit section when they click on it i am showing one form by using protected function _prepareForm() { this function form is showing but when i change data in that form after that i click on save and continue data not sending to controller and i am unable to save data any solution how to save data

https://webkul.com/blog/tab-with-form-in-admin-customer-edit-magento-2/

     protected function _prepareForm() {

            if (!$this->canShowTab()) {
                return $this;
            }
            $customer = $this->getCustomer();

    //        $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORES;
    //        echo $this->_scopeConfig->getValue("cms/wysiwyg_config", $storeScope);
    //        print_r($customer->getData());

            /** @var \Magento\Framework\Data\Form $form */
            $form = $this->_formFactory->create();
    //        $form->setHtmlIdPrefix('pawan_');
    //        $form->setFieldNameSuffix('pawan');

            // start connect pro form //
            $fieldset = $form->addFieldset(
                    'base_fieldset', ['legend' => __('CUstome')]
            );

            $fieldset->addField('connectcheck', 'checkbox', array(
                'label' => __(' Enable/Disable'),
                'name' => 'connectcheck',
                'checked' => ($attr == 1) ? true : false,
                'onchange' => "checking()",
                'value' => '1',
                'disabled' => false,
                'after_element_html' => '<small>Active or Deactivate module for frontend</small>',
                'tabindex' => 1,
                'data-form-part' => $this->getData('target_form'),
            ));
$this->setForm($form);

        return parent::_prepareForm();
    }

Getting error on checking() undefined .I tried adding

 $fieldset->setAfterElementHtml('
                                <script>
                                require(["jquery"], function(jQuery) {
                                function checking()
                                    {
                                            alert("hererere");
                                    }
                                    });
                                                                   </script>
                            ');

can any one tell me how to write on change in block

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top