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

  • Please post the 500 error in your question. – Raphael at Digital Pianism Sep 7 '16 at 7:37
  • @RaphaelatDigitalPianism i think posting on same page will causing itbecause loading the same form again. – Qaisar Satti Sep 7 '16 at 7:42
  • Well post the error from your server error log and we'll know. Assuming is never good in programming – Raphael at Digital Pianism Sep 7 '16 at 7:46
  • @RaphaelatDigitalPianism it is about form element layout errors. add the error. – Qaisar Satti Sep 7 '16 at 7:52
  • @RaphaelatDigitalPianism the button is not redirect to save instead submit on current url via ajax any idea? – Qaisar Satti Sep 7 '16 at 10:10
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.

Your Answer

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

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