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

  • Home
  • SEARCH
  • 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 8688217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:18:18+00:00 2026-06-12T23:18:18+00:00

Building a custom adminhtml module. Im using a simple form. it looks like this

  • 0

Building a custom adminhtml module. Im using a simple form. it looks like this :

<?php

class Namespace_Modulename_Block_Adminhtml_Modulename_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
{
    protected function _prepareForm()
    {
        $form = new Varien_Data_Form();
        $this->setForm($form);
        $fieldset = $form->addFieldset('modulename_form',array('legend'=>Mage::helper('modulename')->__('Module Data')));


    $fieldset->addField('test', 'text', array(
            'label'     => Mage::helper('modulename')->__('Test'),
            'name'      => 'test',
    ));

    // I want to add a custom button here. Say an action called "Add Option".
    //Clicking this action adds input boxes or dropdowns to the form that are to
    //to be included in the post when submitting the form (obviously).

I have been looking for a solution on Stack overflow and have not been able to find something that could help. I have then tried searching for something similar present in the Mage Core.

In the admin panel, if i go to [Catalog->Attributes->Manage Attributes] and click on a standard attribute like “Manufacturer” for example, on the second tab, called “Manage labels/Options” i see the following screen :

add options

There is a button and action which allows me to add options (in the form of textboxes) to the form. Identifying this as something i am trying to replicate, i went into the core to try and figure out what to do. If i open the following files (Magento Enteprise 12.0.2) :

Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Options

I see it is empty, but extends Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract

and I have gone through this file, but little makes sense to me. Am I going down the wrong way? How can I achieve something similar, a button and action which adds fields to a admin form?

thanks

  • 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-12T23:18:19+00:00Added an answer on June 12, 2026 at 11:18 pm
    1. You can set custom template for your form, and add there any tags (like button) via html.
    2. You can add renderer for you field
    $customField = $fieldset->addField('test', 'text', array(
                'label'     => Mage::helper('modulename')->__('Test'),
                'name'      => 'test',
        ));
    
    $customField->setRenderer($this->getLayout()->createBlock('yuormodule/adminhtml_yourform_edit_renderer_button'));
    

    in Block Class

    class Yournamespace_Yourmodule_Block_Adminhtml_Yourform_Edit_Renderer_Button extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface {
      public function render(Varien_Data_Form_Element_Abstract $element) {
        //You can write html for your button here
        $html = '<button></button>';
       return $html;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a custom control that looks like the one in the image
I'm building a custom PHP Session handler using MySql, and I've been struggling with
I am building a custom field feature for my application. This allows the administrator
I am building a custom control using the accordion control included with the Xpages
I am building a custom Content Management System for my client, using C#2008, ASP.Net
Iam building managed custom actions using .net 4.0, but when i package the installer
I am building a custom ,module with a custom content type. I have defined
I am building custom reports in Microsoft CRM and am using the CRM_URL parameter
I'm building a custom report module for my SaaS and need a little advice
I'm building a custom module and I need to be able to add an

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.