after adding the button in ui_component. i give error 500 Internal Server Error not going to post values on save controller. It posting on current url. Example i am using for adding the button.
Question reference
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">categories_index_edit.category_form_data_source</item>
<item name="deps" xsi:type="string">categories_index_edit.category_form_data_source</item>
</item>
<item name="label" xsi:type="string" translate="true">News Category</item>
<!-- <item name="config" xsi:type="array">
<item name="dataScope" xsi:type="string">data</item>
<item name="namespace" xsi:type="string">categories_index_edit</item>
</item> -->
<item name="template" xsi:type="string">templates/form/collapsible</item>
<item name="buttons" xsi:type="array">
<item name="back" xsi:type="string">Namespace\Modulename\Block\Adminhtml\Category\Edit\BackButton</item>
<item name="save" xsi:type="string">Namespace\Modulename\Block\Adminhtml\Category\Edit\SaveButton</item>
</item>
<item name="layout" xsi:type="array">
<item name="type" xsi:type="string">tabs</item>
</item>
</argument>
error
Notice: Undefined index: data in /opt/lampp/htdocs/m2_module/vendor/magento/framework/View/Element/UiComponent /ContentType/Json.php on line 71
0 /opt/lampp/htdocs/m2_module/vendor/magento/framework/View/Element/UiComponent/ContentType/Json.php
(71): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined index...', '/opt/lampp/htdo...', 71, Array)
1 /opt/lampp/htdocs/m2_module/vendor/magento/module-ui/Component/AbstractComponent.php(118): Magento \Framework\View\Element\UiComponent\ContentType\Json->render(Object(Magento\Ui\Component\Form), 'templates /form/...')
2 /opt/lampp/htdocs/m2_module/vendor/magento/module-ui/Component/Wrapper/UiComponent.php(72): Magento \Ui\Component\AbstractComponent->render()
-
Please post the 500 error in your question.Raphael at Digital Pianism– Raphael at Digital Pianism2016年09月07日 07:37:10 +00:00Commented Sep 7, 2016 at 7:37
-
@RaphaelatDigitalPianism i think posting on same page will causing itbecause loading the same form again.Qaisar Satti– Qaisar Satti2016年09月07日 07:42:44 +00:00Commented Sep 7, 2016 at 7:42
-
Well post the error from your server error log and we'll know. Assuming is never good in programmingRaphael at Digital Pianism– Raphael at Digital Pianism2016年09月07日 07:46:25 +00:00Commented Sep 7, 2016 at 7:46
-
@RaphaelatDigitalPianism it is about form element layout errors. add the error.Qaisar Satti– Qaisar Satti2016年09月07日 07:52:45 +00:00Commented Sep 7, 2016 at 7:52
-
@RaphaelatDigitalPianism the button is not redirect to save instead submit on current url via ajax any idea?Qaisar Satti– Qaisar Satti2016年09月07日 10:10:01 +00:00Commented Sep 7, 2016 at 10:10
1 Answer 1
After lot of searches i found that problem was with the magento version ui_component form is only working magento 2.1. After moving this code to magento 2.1 solved the problem.
-
please edit the magento spellings in your postTeja Bhagavan Kollepara– Teja Bhagavan Kollepara2016年09月09日 11:57:00 +00:00Commented Sep 9, 2016 at 11:57
-
You are welcome sir. you helped me many times.Teja Bhagavan Kollepara– Teja Bhagavan Kollepara2016年09月09日 12:07:51 +00:00Commented Sep 9, 2016 at 12:07