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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:52:12+00:00 2026-05-26T02:52:12+00:00

I want to use a view script to render my zend form as it

  • 0

I want to use a view script to render my zend form as it seems to be the best way to
control the layout/design of the form while still using the Zend_Elements classes.

From the view script, I render the element with $this->element->getElement('elementName') .

I’m having problems with the names of the elements. This is actually a sub-form inside a sub-form inside a form.

When I used the FormElements decorators , the fully qualified name of the elements was form[subForm][subForm][element] , which was good.
Wehn I moved to the viewScript decorators, it changed to subForm[subForm][element].

I understood that I need to use the PrepareElements decorator to fix this, but this caused the name to change form[subForm][form][subForm][subForm][elements] (it doubled the first two names in the start).

Any ideas how I should handle this?

Thanks.

UPDATE: I tried to debug PrepareElements and I really don’t understand what is doing.
It seems like it works ok in the first iteration, but then it adds again the form[subform] prefix when running on one of the middle subforms.

When I’m not using the PrepareElements decorator, I’m just missing the “form” prefix in the names (i.e., instead of form[subForm][element], I get only subForm[element]).

May be I can just fix this somehow?

I tried to change the belongsTo but that only replaced the “subForm” prefix .

It actually seems like what is missing is a belongsTo method on the subForm.

Again, this is all because of the ViewScript decorator. It works fine with the FormElements decorators.

UPDATE 2: Just to clarify, I wouldn’t mind this name change, but it causes my fields to not populate when I call form->populate .

Edit: I think that I’ve narrowed the problem to this: when I get my values back in setDefaults, they are ordered like this:

array(
\"formElements1-name\" => value1... \"subFormName\" => array(
\"parentFormName\" => array(
\"subFormName\" => subForm-values-array
)
)

…
The main problem here is the "parentFormName" => "subFormNAme".. what does it repeat itself? I’m already in the main form. I’m guessing this is caused because I’ve set the setElementsBelongTo(formName[subFormName]) , but if I wouldn’t do that, then I would get my subform values completely separate from the form,

i.e.
values array = array(
\”formName\” => array(
formValues
), \”subFormNAme\” => array(
subFormValues
)

, while I exepct it to be

array(
formName => array(
subFormNAme => values-array
)
)...

Is it even possible to make this work?

  • 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-26T02:52:13+00:00Added an answer on May 26, 2026 at 2:52 am

    The current solution is to use the PrepareElements decorator on the subforms with one change – remove the recursive call in the PrepareElements code. Also, no “setElementsBelongTo” is required.

    This seem to generate the correct names and ids.

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

Sidebar

Related Questions

Basically, I want to render a view and layout from a model. Don't ask
So I want to use a jQuery tab container in my view script. I
I want to use the MultipleLookupField control in a web page that will run
I want to use the Web Browser control within an mono application, but when
I want to use the plugin jConfirm to confirm the submit of a form.
I want to use Telerik DatePickers and IntegerTextBoxes on my Partial View loaded via
I want use groovy findAll with my param to filtering closure filterClosure = {
i want use some data from a website with web service. i have a
I have a transaction log file in CSV format that I want use to
Below is my stored procedure. I want use stored procedure select all row of

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.