[fw-general] Zend Forms - Dynamic Content

2008-09-19 Thread Jamie Royer
I figured out how to dynamically add sub-forms to a form using Ajax and
Zend Framework.

 

I want to share what I've done as well as seek feedback on how I could
implement it better.

 

I've setup Drupal on my home computer to host the article and comments.
I've also set up a link to demonstrate working code.

 

Article: http://www.canadiandev.com http://www.canadiandev.com/ 

Demo: http://dynamic.canadiandev.com http://dynamic.canadiandev.com/ 

 

Thanks,
Jamie



[fw-general] Zend_Form and JS: How to find fields?

2008-06-09 Thread Jamie Royer
Hi Everyone,

I'm trying to figure out how to get a field's id using javascript and
assigning the id to a variable from within ZF.

I have form A that adds sub-form B that adds field F.  When the form
is rendered field F is named a[b][f] with an id of a-b-f.

I'd like to not hard-code the field id as a-b-f so that I can re-use the
sub-form and nest it at any depth.

I can't figure out how to get the id of the field so that I can manipulate
it with javascript from the browser.

I create the form in the init() function and this is where I want to add
javascript using $this-getView()-headScript()-appendFile('file.js') so
I can keep the javascript associated with a particular sub-form together in
one place.

Is there a good solution?


Thanks in advance,
Jamie

If it is not obvious, I'm very new to web development - not programming - just 
new to web development.


[fw-general] Is this possible: Zend_SubForm with user added records?

2008-05-29 Thread Jamie Royer
Is it possible to use Zend_Form_SubForm with dynamic content added by
the user?

I'm trying to create a sub-form that can contain 0-N records (input
fields plus a delete button).  When the user presses the add button a
new record gets added to the sub-form.  When the user presses the
submit button, I want the form to be validated allowing for 0-N
records.

I already have nice looking forms built up from nested sub-forms so I
was hoping not to have to throw that all away.  The server generated
forms work great.

I'll need to figure out how to use populate() to pre-fill the
sub-form.

Am I approaching this the wrong way?

I like the idea of using Zend_Form but is there a better way?

Thanks,
Jamie Royer