Zend Framework - Add new input element using javascript

前端 未结 2 537
孤城傲影
孤城傲影 2020-12-10 07:08

I\'m working on a project using Zend Framework.

I\'m creating a form on which users can add a set of elements by pressing a + sign.

Zend framework uses subfo

2条回答
  •  粉色の甜心
    2020-12-10 07:53

    The best demo of dynamically adding fields on the client to a Zend_Form with which I am familiar comes from Jeremy Kendall:

    http://jeremykendall.net/2009/01/19/dynamically-adding-elements-to-zend-form/

    The upshot of the technique is to add/call a preValidation() method on the form to check the post for fields missing in the form. If it finds any such fields, then they are added to the form object. By the time isValid() and getValues() are called, all the Zend_Form_Element objects have already been attached to the form, so processing runs as normal.

提交回复
热议问题