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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:15:13+00:00 2026-05-16T09:15:13+00:00

I got two forms and they share some ids as two input fields are

  • 0

I got two forms and they share some ids as two input fields are called ‘title’.

Zend generates me a nice output like this:

<dl class="zend-form">
  <dt id="title-label">
    <label for="form1-title" class="required">Description</label>
  </dt>
  <dd id="title-element">
    <input name="form1[title]" id="form1-title" value="..." type="text">
  </dd>
</dl>

Now the problem is that the dt and the dd elements are named wrong (should be form1-title-lable as this is a sub form).

I also tried to change the element decorators:

$this->addElements( ... );
$this->setElementDecorators(array(
        'ViewHelper',
        'Errors',
        array(array('data' => 'HtmlTag'),array( 'tag' => 'dd', 'class' => 'element' )),
        array(array('data' => 'Label'),array( 'tag' => 'dt', class=> 'label' ))
  ));

However the outcome wasn’t as expected.

A label was added to my submit button and
the ids of the dt elements were still there.

How do you remove the id attributes?


Edit – Element declaration:

    $titel = new Zend_Form_Element_Text('title');
    $titel->setLabel( "Title" )
          ->addValidator('NotEmpty', true)
          ->addValidator('stringLength',true, array(0, 255 ))
          ->setRequired(true)
          ->addFilter("Alnum", array(true))
          ->addFilter('StringTrim');

    $this->addElement($titel);
  • 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-05-16T09:15:14+00:00Added an answer on May 16, 2026 at 9:15 am

    It sounds more like the problem is in your subforms not prepending their names to the ID. If you solve that then you won’t need to remove the IDs.

    But, if you want to remove the ID from an element using the DtDdWrapper decorator, you can do something like this.

    class Form_Foo extends Zend_Form_SubForm
    {
        public function init()
        {
    
            $title = new Zend_Form_Element_Text('foo_title');
            $title->setLabel('Title');
            $title->removeDecorator('DtDdWrapper');
            $title->addDecorator(new Decorator_Foo());      
            $this->addElement($title);
        }
    }
    
    class Decorator_Foo extends Zend_Form_Decorator_DtDdWrapper
    {
        public function render($content)
        {
            return '<dt>&nbsp;</dt>' .
                   '<dd>' . $content . '</dd>';
        }
    }
    

    That should give you elements without an ID tag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got two different forms in my WinForms app (MainForm and Form2 say). They
I have the following problem. I got two forms on my web page. On
In my rails application I have two models called Kases and Notes. They work
I've got a Windows Forms application with two ListBox controls on the same form.
I've got two date pickers in one form. They have different id's so this
I've got a bit of a usability issue that I'd value some input on.
I have two related fields in a Yii model. They are items_per and items_period.
Here's the situation: I've got two partial views. One has a form. What needs
I got stuck with this problem. I wrap two tables inside of a h:form.
I got two data storages in my Windows Azure account. One is for the

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.