0

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()

5
  • Please post the 500 error in your question. Commented Sep 7, 2016 at 7:37
  • @RaphaelatDigitalPianism i think posting on same page will causing itbecause loading the same form again. Commented Sep 7, 2016 at 7:42
  • Well post the error from your server error log and we'll know. Assuming is never good in programming Commented Sep 7, 2016 at 7:46
  • @RaphaelatDigitalPianism it is about form element layout errors. add the error. Commented Sep 7, 2016 at 7:52
  • @RaphaelatDigitalPianism the button is not redirect to save instead submit on current url via ajax any idea? Commented Sep 7, 2016 at 10:10

1 Answer 1

0

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.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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