View Single Post
  #1 (permalink)  
Old 05-23-2008, 07:43 PM
cdndev cdndev is offline
Junior Member
 
Join Date: May 2008
Posts: 2
Default Zend_Form_SubForm - How to add dynamic content

I've been googling for an answer but I don't know how to phrase the question to my problem so I'm hoping this is the right place to ask.

I want to create a Zend_Form_SubForm that can contain a variable number of records. When the user clicks the "Add" button, I want to add a record. When the user submits the data I want the Zend_Form_SubForm to validate the data.

Initially the form will contain no records but after adding records, a subsequent request for the page will return rows.

How do I add HTML content to a Zend_Form_SubForm? (I want to create a button using an "a" tag and CSS - I have it working on a "sidebar.phtml".)

I'll use Javascript to add/remove records, but how do I name the fields so that the data can be validated? When I add a select field it looks like this:

HTML Code:
<select name="form1[tslist][tscode]" id="form1-tslist-tscode">
How do turn this into an array? Is it simply a matter of adding [1] after [tscode]?

Thanks in advance,
Jamie
Reply With Quote