Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7730433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:13:23+00:00 2026-06-01T06:13:23+00:00

Magento 1.6.1 I am trying to get form data on my observer. I tried

  • 0

Magento 1.6.1 I am trying to get form data on my observer. I tried
$observer->getEvent()->getForm();
and it’s empty. here is some of my code

            <catalog_product_new_action>
            <observers>
                <namespace_module_save_product_stuff>
                    <type>singleton</type>
                    <class>Namespace_Module_Model_Observer</class>
                    <method>saveProductStuff</method>
                </namespace_module_save_product_stuff>
            </observers>
        </catalog_product_new_action>  

The event observer fires, but i can’t get the form at all it just returns null.

public function saveProductStuff(Varien_Event_Observer $observer) 
    {
        $roleId = implode('', Mage::getSingleton('admin/session')->getUser()->getRoles());
        $roleName = Mage::getModel('admin/roles')->load($roleId)->getRoleName();
        if($roleName != 'Administrators'){

                try 
                {   

                    $form = $observer->getEvent()->getForm();
                    var_dump($form);
                }   catch (Exception $e)
                          {
                            Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
                          }

        }
    }

I really need to get this form on the observer but nothing is happening and ive spent looking at tutorials but all of them give you this method of doing things.

The event fires and i can do things inside it but not getting the form.

I need to get the form, then set a an element to disabled if its a certain type of user, i cant set it to locked because then the attribute won’t save. I wanted to try something like this:

    $form = $observer->getEvent()->getForm();//returns NULL
$element = $form->getElement('attribute_code');
$value = 'test';

$element->setValue($test);
$element->setDisabled(true);

But no luck. I would really appreciate any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:13:24+00:00Added an answer on June 1, 2026 at 6:13 am

    Unfortunately, with this event, there isn’t a way to get the form. Here is how it is called (app/code/core/Mage/Adminhtml/controllers/ProductController.php:192):

    Mage::dispatchEvent('catalog_product_new_action', array('product' => $product));
    

    Depending on what you are trying to do, you may have to override some files. Please don’t modify the core files! The reality is that if you are saving something, that isn’t the time to be disabling a control. You will want to do that when the page loads.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get some data from Magento trough php, it works but
I'm trying to get some custom routing going on in Magento using the following
Magento 1.7.0.2: I'm trying to get a form (in the backend) to upload a
I'm currently trying to get PHPUnit working with together with Magento. On some places
I'm trying configure memcache using Magento. Looking around in the code, I see some
Magento 1.7 in the code below I'm trying to get the product attribute Minimum
I am trying to debug Magento Code through Eclipse PDT. I configured X-Debugger properly
I am trying to render the magento contact form into a .phtml file, but
I am trying to get a magento installation to run multiple websites I have
I'm trying to get some currency exchange rates in a seperate php file in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.