I have a zend_form where I'm allowing the user to add form elements dynamically. Elements are added dynamically using jQuery : something like...
$(function(){
$('#more_answers').click(function(){
var elemNum = $('.dummy-element').size();
$("<dd class='dummy-element' id='dummyanswer_"+elemNum+"-element'><input type='text' value='' id='dummyanswer_"+elemNum+"' name='dummyanswer_"+elemNum+"'></dd>").insertBefore('#more_answers-element');
return false;
});
});
The element is added correctly-within the tags. When I submit,the element added is not submitted. I checked in the in the Net view in firebug and the variable is indeed not passed at all.
What could the issue be? Would it have anything to do with zend_form specifically? I have added elements in the past to Zend_Forms using raw JavaScript and it was working just fine.
Any thoughts?
Thanks, I really appreciate it!
More markup for form elements as requested:
<dd class="dummy-element" id="dummyanswer_2-element">
<input type="text" value="" id="dummyanswer_2" name="dummyanswer_2">
</dd> <!-- this element was NOT added using jquery -->
<dd id="dummyanswer_3-element" class="dummy-element">
<input type="text" name="dummyanswer_3" id="dummyanswer_3" value="">
</dd> <!-- this element was added using jquery -->
<dd id="more_answers-element">
<input width="170px" height="30px" type="image" style="" class="addDummyAnswer" src="/images/add_more_dummy_answers_button_370X60px.png" id="more_answers" name="more_answers">
</dd>