Magento 1.8 – How to Add CSS Class or ID in Form for TR

formsmagento-1.8

Hi I am having problem with Adminhtml form customization.
I am trying to hide the table row, but tr does not have any selector, so I am trying to add the selector to the table row.
I don't know how to add selectors. If anyone know please help me.

Here is my Form

$form = new Varien_Data_Form();
        $this->setForm($form);
        $fieldset = $form->addFieldset('storeadvertisement_form', array('legend'=>Mage::helper('advertisement')->__('Advertisement Media')));
        $fieldset->addType(
            'image',
            'Npm_Advertisement_Block_Adminhtml_Storeadvertisement_Helper_Image'
        );
        $fieldset->addField('url', 'text', array(
            'label'     => Mage::helper('advertisement')->__('Video URL'),
            'required'  => true,
            'style'     =>'display:none',
            'name'      => 'url',
            ));

        $fieldset->addField('link', 'text', array(
            'label'     => Mage::helper('advertisement')->__('Link'),
            'required'  => true,
            'name'      => 'link',
            'class'     =>  'validate-url'
        ));

Thanks in advance.

Best Answer

You don't need a selector on the <tr> element.
You can identify the table row based on the input.
Let's say the input (or select or textarea) has the id some_input.
You can get the tr element like this:

var tr = $('some_input').up(1);

As a side note, you can get the <td> element like this:

var td = $('some_input').up();
Related Topic