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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:53:17+00:00 2026-05-15T22:53:17+00:00

Is there any way that i can render ONLY the start <form> tag of

  • 0

Is there any way that i can render ONLY the start <form> tag of a Zend_Form object?

print $this->registerForm->renderForm();

renders <form></form>, and i only need <form>

Edit:

After Asleys possible solution i wrote this for My_Form class

public function renderFormOpen() {
    return str_replace('</form>', '', $this->renderForm());
}

public function renderFormClose() {
    return '</form>';
}

Still looking for at ZF way of doing thins, even though i don’t think there is any – after going through the code in the ZF library.

  • 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-15T22:53:17+00:00Added an answer on May 15, 2026 at 10:53 pm

    You could write an custom form-decorator that uses a custom view-helper that only renders the open form tag. But I think this would be overkill.
    Just “hardcode” the form-tags and fill the attributes with the data provided by the form-variable in your view.

    <!--in your view-template -->
    <form action="<?php echo $this->form->getAction() ?>"
          enctype="<?php echo $this->form->getEnctype() ?>"
          method="<?php echo $this->form->getMethod() ?>"
          id="<?php echo $this->form->getId() ?>"
          class="<?php echo $this->form->getAttrib('class') ?>" >
    
        <!--in case your products are represented as elements -->
        <?php foreach ($this->form->getElements() as $element): ?>
           <?php echo $element ?>
        <?php endforeach; ?>
    
        <!--in case your products are represented as displayGroups -->
        <?php foreach ($this->form->getDisplayGroups() as $displayGroup): ?>
           <?php echo $displayGroup ?>
        <?php endforeach; ?>
    
        <!--in case your products are represented as subforms -->
        <?php foreach ($this->form->getSubforms() as $subform): ?>
           <?php echo $subform ?>
        <?php endforeach; ?>
    
        <!--in case your products are rendered by a view helper -->
        <?php foreach ($this->products as $product): ?>
           <?php echo $this->renderProduct($product) ?>
        <?php endforeach; ?>
    </form>
    

    Just for fun the overkill way

    // Get your products form
    $form = new Form_Products();
    // Add custom prefix path
    $form->addPrefixPath('Foobar_Form_Decorator', 'Foobar/Form/Decorator', 'decorator');
    // Set OnlyOpenTagForm-ViewHelper for FormDecorator
    $form->getDecorator('Form')->setHelper('OnlyOpenTagForm');
    
    // copy Zend/View/Helper/Form to Foobar/Form/Decorato/OnlyOpenTagForm.php
    // In OnlyOpenTagForm.php
    //   replace Zend_View_Helper_Form with Foobar_View_Helper_OnlyOpenTagForm
    //   replace method "form" with onlyOpenTagForm"
    //   replace
    if (false !== $content) {
        $xhtml .= $content
               .  '</form>';
    }
    //   with:        
    if (false !== $content) {
        $xhtml .= $content;
    }
    

    Done! – The Java-Guys will love it 😉

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

Sidebar

Related Questions

Is there any way that I can use C# to load and then render
Is there any way that I can make it so when someone clicks save
Is there any way that I can programmatically create (and I guess access) hidden
Is there any way that I can change how a Literal of a code
Is there any way that I can find the container pointed to by an
Is there any way that I can create a new delegate type based on
Is there any way that I can pass arguments in selector? example: I have
Is there any way that I can list the pages which are currently stored
Is there any way that I can call a JavaScript function via css? For
Is there any way that I can detect browser type on routing and use

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.