开发者

Zend_Form : Adding fields in sub-forms on user's click

开发者 https://www.devze.com 2022-12-16 16:17 出处:网络
I\'m having a zend form - comprised of a number of zend - sub forms,where the user is creating a new question (its a content management system).

I'm having a zend form - comprised of a number of zend - sub forms, where the user is creating a new question (its a content management system). In one of the subforms, the user can click on a button to add more textfields, like this:

[----------] [----------] [click to add more]

which should give

[----------] [----------] [----------] [click to add more]

I'm trying to set a flag in the sub form in question - or set a count on how many times the button has been clicked, to add that many total fields to the subform - but its simp开发者_JAVA百科ly not working. I tried using a static count variable - but the value doesnt get incremented at all.

Any thoughts on how to do this in a Zend-subform within a zend form? I'll definitely update if I hit a solution. Thanks!


I used Sessions to store the click. i tried doing this with javascript but within the subform it was not working. if i simply have such a situation where there is just 1 form (no subforms), the javascript solution works fine. effectively, just increment the counter by one onclick. with sessions, or some other global variable, simply do the same - increment the counter, and unset that var when the form is submitted. so - when u come back to the form, the previous session var value is not retained.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号