1

I'm working with Zend Form and I need to dynamically (when filling out the form by user) add groups of elements. For example I have form with few fields describing offer and one subform to set offer price. But offer can have more than one price and price is not only 1 element, its composed of

  1. offer regular price
  2. offer discount price
  3. offer items count

So there are 3 different elements in one gruop.

I can create elements with javascript but when should I add them to Zend Form Object?

1 Answer 1

1

you could make each of the groupings a subform that way when you add via javascript, you could ajax that portion of the form in by just rending the subform with a 'Belongsto'. Then, you could read in your post when it comes back to you and do a foreach on it and add the elements back that way.

check out http://www.stephenrhoades.com/?p=364

Otherwise, in your ajax to get the form markup, you could be building a form object that you could save to the session, that way it will already be built at posting time.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.