I am new to magento and using magento 1.9 version.

I want show/Hide adminpanel form field based on the other checkbox is checked.

How to do this using javascript.


As an example you have two field:

$checkbox = $fieldset->addField('name', 'checkboxes', array('label' => 'check', 'name' => 'name[]',
    'values' => array(
        array('value'=>'1', 'label'=>'1'),
        array('value'=>'2', 'label'=>'2'),
        array('value'=>'3', 'label'=>'3'),
        array('value'=>'4', 'label'=>'4'),
        array('value'=>'5', 'label'=>'5'),

                'label' => Mage::helper('module')->__('Another Field'),
                'name' =>  'another_field',

    ->addFieldDependence($another_field->getName(),$checkbox->getName(),1) );

From above code if 1 checkbox checked then textarea will be visible.

|improve this answer|||||
  • @SaravananDS if it helps you please mark is accepted so in future it will be helpful for others – Prashant Valanda Nov 17 '16 at 8:03

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.