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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:52:59+00:00 2026-06-10T13:52:59+00:00

I am trying to add some html to a zend form but I can’t

  • 0

I am trying to add some html to a zend form but I can’t find what I want.
So I create the elements then I have this code:

$form->addDisplayGroup(array('firstElement', 'secondElement'), 'user', array('legend' => 'My legend'));

$form->setDisplayGroupDecorators(array(
    'FormElements',
    array('HtmlTag', array('class'=>'myClass', 'tag' => 'div'))
));

I get rid of the fieldset and the legend because it’s impossible to style it correctly. So I replace the fieldset with a div, but I need to create a h2 or something to replace the legend. Is there any way to add this in the group decorators?

PS: I know there is a lot of similar questions and I tried them all. It didn’t work mainly because I can’t add a form element in Zend Framework (I don’t have access to the directory to add a class on the server).

  • 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-10T13:53:00+00:00Added an answer on June 10, 2026 at 1:53 pm

    I finally found the solution to my problem with the description.
    In case anybody has the same issue, here is how I did:

    $group = $form->getDisplayGroup('nameOfTheGroup');
    $group->setDescription('The text you want');
    $group->setDecorators(array(
        'FormElements',
        array('HtmlTag', array('tag' => 'div', 'class' => 'myClass')),
        array('Description', array('tag' => 'h2', 'placement' => 'prepend'))
    ));
    

    This will add the description in a h2 tag before the div.

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

Sidebar

Related Questions

I've been trying to add HTML content to a web view, but can't seem
Trying to add some html to a TextArea in Mobile Flex 4.5 but keep
I have an html table that I am trying to add some animation to
I'm trying to add some HTML formatted text to Word using Office Interop. My
I'm trying to add extra HTML attributes to some select options in a dropdown
I am trying to add a full html page into ckeditor for some editing
I am trying to add some logic in this. But I am not sure
I'm trying to add some html markup to the WYSIWYG CLEditor from outside of
I am trying to add some additional html to a div with id slideshow
I'm trying to add some jQuery + ERB to a specific view: views/posts/show.html.erb (top

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.