I am developing a custom magento (1.9) module and have created a form in the admin to add / edit an entity called "subscription". This will either create a new subscription object or edit an existing subscription object.

Following is my SubscriptionController.php


class Beyondroid_Subscribepro_Adminhtml_SubscriptionsController extends Mage_Adminhtml_Controller_Action {

    public function indexAction() {
        $subscriptionsBlock = $this->getLayout()

        $this->getLayout()->getBlock('head')->setTitle($this->__('Beyondroid SubscribePro - Subscriptions'));

    public function editAction() {
        $subscription = Mage::getModel('subscribepro/subscriptions');
        if ($subscriptionId = $this->getRequest()->getParam('id', false)) {
            if (!($subscription->getId())) {
                    $this->__('This subscription no longer exists.')

        if ($postData = $this->getRequest()->getPost('subscriptionsData')) {
            try {

                    $this->__('Subscription data was updated')
                return $this->_redirect(
                    'adminhtml/subscriptions/edit', array('id' => $subscription->getId())
            } catch (Exception $e) {
        Mage::register('current_subscription', $subscription);
        $subscriptionEditBlock = $this->getLayout()->createBlock(


    public function saveAction() {

    protected function _isAllowed() {
        $actionName = $this->getRequest()->getActionName();
        $adminSession = Mage::getSingleton('admin/session');
        $isAllowed = $adminSession->isAllowed('beyondroid_subscribepro/subscriptions');
        return $isAllowed;

and here is the Subscriptions/Edit/Form.php

class Beyondroid_Subscribepro_Block_Adminhtml_Subscriptions_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {

    protected function _prepareForm() {
        $form = new Varien_Data_Form(array(
            'id' => 'edit_form',
            'action' => $this->getUrl('*/*/save', array(
                'id' => $this->getRequest()->getParam('id'),
            'method' => 'post',
            'enctype' => 'multipart/form-data',

        $fieldset = $form->addFieldSet(
            array('legend' => 'Subscription Details')

        $currentSubscription = $this->_getSubscription();

        $fieldset->addField('product_id', 'text', array(
            'label' => 'Product ID',
            'required' => true,
            'note' => 'This resembles the product ID for this subscription',
        $fieldset->addField('deliveries', 'text', array(
            'label' => 'No. of deliveries (in a month)',
            'required' => true,
            'note' => 'This resembles the number of deliveries to be made for this kind of a subscription in one month',
        $fieldset->addField('unit_price', 'text', array(
            'label' => 'Unit Price',
            'required' => true,
            'note' => 'This defines how much each delivery costs',

        return parent::_prepareForm();

    protected function _getSubscription() {
        if (!$this->hasData('subscriptions')) {
            $subscription = Mage::registry('current_subscription');
            if (!$subscription instanceof
                    Beyondroid_Subscribepro_Model_Subscriptions) {
                $subscription = Mage::getModel(
            $this->setData('subscription', $subscription);
        return $this->getData('subscription');

Form Loaded

The form gets loaded properly in both new/edit cases (as can be seen in the image above). The problem is when I try to save the form, I do not get any post data. Clicking the save button does route to the saveAction method in my controller but the post data is an array with only 1 key value pair i.e. form_key => 'some random string'.

Following is what var_dump statement in saveAction method returns:

No Post Data

Any Ideas what am I missing here ?


Following is what I see in the request payload i.e. missing post data :O

enter image description here

Update 2

The html structure of the form looks fine. The fields are inside the <form></form> tags and only 1 form on the page.

enter image description here

  • What is really posted to your controller? (using your browser's developer console) Commented Nov 10, 2015 at 14:08
  • The request payload consists of only form_key. Updated the question to include a screenshot of request payload data.
    – Amyth
    Commented Nov 10, 2015 at 14:13
  • check the page source and make sure you don't have a form inside an other form or that your fields are not outside the form you are submitting.
    – Marius
    Commented Nov 10, 2015 at 14:17
  • @Marius just checked that. There is only 1 form on the page and all the fields are inside the form tag. Added a screenshot.
    – Amyth
    Commented Nov 10, 2015 at 14:20

1 Answer 1


On your latest screenshot I see that the fields you are submitting don't have a name.

Look at the input with the id product_id for example. the name attribute is empty.

I think the problem comes from the way you defined your fields.

Let's take this for example:

   $fieldset->addField('product_id', 'text', array(
        'label' => 'Product ID',
        'required' => true,
        'note' => 'This resembles the product ID for this subscription',

There is no name attribute in the configuration array.
it should be something like this:

   $fieldset->addField('product_id', 'text', array(
        'name' => 'product_id', //you are missing this in your code
        'label' => 'Product ID',
        'required' => true,
        'note' => 'This resembles the product ID for this subscription',

do the same for the other fields and try again.

  • @Marius what if I have the name added but input still not passed ? Commented Oct 15, 2016 at 16:26
  • @VasiliiBurlacu then I don't know
    – Marius
    Commented Oct 15, 2016 at 17:53

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.