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 8071847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:49:29+00:00 2026-06-05T13:49:29+00:00

Setting up a custom form. Magento doesn’t use the ‘value’ attribute of addField. Suggestions?

  • 0

Setting up a custom form. Magento doesn’t use the ‘value’ attribute of addField. Suggestions?

Code:

$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',
));

$form->setUseContainer(true);
$this->setForm($form);

$fieldset = $form->addFieldset('example_form', array(
     'legend' =>Mage::helper('categoryrules')->__('Example Information')
));

...

$entityType = Mage::getModel('eav/config')->getEntityType('test_category_rule');
$entityTypeId = $entityType->getEntityTypeId();

...

$fieldset->addField('entity_type_id', 'hidden', array(
      'name'               => 'entity_type_id',
      'value'              => $entityTypeId
));

Output:

<input id="entity_type_id" name="entity_type_id" value="" type="hidden">

EDIT:

results of print_r($entityType->debug());

Array ( 
    [entity_type_id] => 11 
    [entity_type_code] => rogue_category_rule 
    [entity_model] => categoryrules/rules 
    [attribute_model] => 
    [entity_table] => categoryrules/rules 
    [value_table_prefix] => 
    [entity_id_field] => 
    [is_data_sharing] => 1 
    [data_sharing_key] => default 
    [default_attribute_set_id] => 0 
    [increment_model] => 
    [increment_per_store] => 0 
    [increment_pad_length] => 8 
    [increment_pad_char] => 0 
    [additional_attribute_table] => 
    [entity_attribute_collection] => 
)
  • 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-05T13:49:31+00:00Added an answer on June 5, 2026 at 1:49 pm

    Try to write here any constant like:

    $fieldset->addField('entity_type_id', 'hidden', array(
          'name'               => 'entity_type_id',
          'value'              => 11
    ));
    

    Or:

    $fieldset->addField('entity_type_id', 'hidden', array(
          'name'               => 'entity_type_id'
    ));
    $form->setValues($entityType->getData());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble setting a custom back button. Below is the current code I'm
I'm trying to set custom 'name' attribute in django form. I've been trying this
I'm looking for help setting a new default property value for an inherited control
I am setting up a form using JSF (I'm pretty new at this) and
in my custom theme-settings.php (zen-subtheme) i put following code to get a new textarea
We are setting up a new Magento site and will allow clothing designers the
I am setting a custom font in my UIBarButtonItem objects using UIAppearance . This
I am setting a custom session in the catalog/controller/checkout/cart.php controller. All it does, it
I'm setting a custom StatusDescription in a RESTful WCF service when an exception is
I'm setting a custom banner and dialog image for my WiX generated MSI. <WixVariable

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.