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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:20:51+00:00 2026-06-11T14:20:51+00:00

I am working on one project in zend framework 1.12. for generating decorators I

  • 0

I am working on one project in zend framework 1.12. for generating decorators I have created one class ‘Application_Form_Base’ which extends ‘Zend_Form’. I have written code in this class in such a manned when I add new element with label decorator in my form it applies one css class ‘field_label’ on that label. The problem comes that for some form, I just want to remove this css class of the label at run time. anyone has idea, how can I remove this css class at run time when rending form elements?

Following is my intermediate form class

<?php

class Application_Form_Base extends Zend_Form
{

public $elementDecorators = array(
        'ViewHelper',
        'Errors',
        array(
                'label',
                array(                          
                        'class' => 'field_label'
                )
        ),
        array(
                array(
                        'row' => 'HtmlTag'
                ),
                array(
                        'tag' => 'div',
                        'class' => 'form-row'
                )
        )
);

public $buttonDecorators = array(
        'ViewHelper',
        array(
                array(
                        'label' => 'HtmlTag'
                ),
                array(
                        'tag' => 'label',
                        'placement' => 'prepend',
                        'class'=>'field_label'
                )
        ),
        array(
                array(
                        'row' => 'HtmlTag'
                ),
                array(
                        'tag' => 'div',
                        'class' => 'form-row'
                )
        )
);

public function loadDefaultDecorators ()
{
    $this->setDecorators(
            array(
                    'FormElements',
                    array(
                            'HtmlTag',
                            array(
                                    'tag' => 'div',
                                    'class' => 'zendForm'
                            )
                    ),
                    'Form'
            ));
}
}

following is snippet of my search form

class Admin_Form_SubscribeSearch extends Application_Form_Base
{

public function init()
{
    $locale = Zend_Registry::get('Zend_Translate');

    /* Form Elements & Other Definitions Here ... */

    $this->setMethod('post');
    $this->setName('searchPackage');

    $this->addElement('text','name',array(
        'label'=>$locale->translate('label_name'),
        'required'=>true,
        'decorators'=> $this->elementDecorators,
        'filters'=>array('StringTrim'),
        'class'=>'',   
    ));

following is the html output generated for that form field.

<label class="field_label required" for="price">name</label>

I want to remove this ‘field_label’ class when rending form elements in the view. how can I achieve this?

  • 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-11T14:20:52+00:00Added an answer on June 11, 2026 at 2:20 pm

    You can set specific decorator for specific element:

    $element = $this->getElement('name');
    $element->setDecorator(array('Label')); // without additional class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on one project which is too complex and contain very
I'm working with an external framework (redmine) which has one Project model that has_many
I am working on one of the project which requires class MyObj; map<string, MyObj*>
I'm working on a project which contains several slave nodes and one master node.
I am working on project where I have the checkInternet method in one of
I am working on one project. In which i want to find out Is
I am working on a project using zend framework, php, mysql on ubuntu. I
Hi I'm currently working on some php - zend framework project on my osx
We have one project built upon asp.net framework 2.0. It is completely tested and
i have one project working greate but in other iphone not working .both are

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.