You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The view has a button for adding tags dynamically (like in this example: http://zf2.readthedocs.org/en/latest/modules/zend.form.collections.html#adding-new-elements-dynamically), which works fine in the edit-action. When adding a new blogpost with 2 tags at the same time, it only adds 1 tag in the database (the count option is set to 1. When I increase this number, it is able to add tags according to the option). When I edit that blogpost and add 2 tags (total of three), 2 tags are added to the database.
When debugging the addTags() function, the parameter holds only 1 Tag object at the add-action. In the edit-action it holds all the new tags that have been added (in my case, 2 new tags).
$('#addTag').click(function(e) {
var currentCount = $('form > #tagFieldset > label').length;
alert(currentCount);
//Set datatemplate (generated by the arraycollection)
var template = $('form > #tagFieldset > span').data('template');
//Replace the template to other addressfieldset
template = template.replace(/__index__/g, currentCount);
//Set new fieldset
$('form > #tagFieldset').append(template);
});
It renders my templates correctly. Works fine in my edit-action, but my add-action only add 1 tag. I’ve no idea why. Maybe that the add-action doesn’t recognize the dynamically created fields?
The text was updated successfully, but these errors were encountered:
I'm closing this - we're unable to provide support on such very localized questions.
Please insulate the problem first, then report it as issue once confirmed and when you have a simplified example that does not involve view helpers and js.
I’ve a problem with my collections. I’ve followed the example tutorial (https://github.com/doctrine/DoctrineModule/blob/master/docs/hydrator.md#a-complete-example-using-zendform) and have succesfully made a Blogpost and Tag entity. In my controller I’ve an add action and edit action. My add and edit views:
The view has a button for adding tags dynamically (like in this example: http://zf2.readthedocs.org/en/latest/modules/zend.form.collections.html#adding-new-elements-dynamically), which works fine in the edit-action. When adding a new blogpost with 2 tags at the same time, it only adds 1 tag in the database (the count option is set to 1. When I increase this number, it is able to add tags according to the option). When I edit that blogpost and add 2 tags (total of three), 2 tags are added to the database.
When debugging the addTags() function, the parameter holds only 1 Tag object at the add-action. In the edit-action it holds all the new tags that have been added (in my case, 2 new tags).
My blogpostFieldset look likes:
And my javascript:
It renders my templates correctly. Works fine in my edit-action, but my add-action only add 1 tag. I’ve no idea why. Maybe that the add-action doesn’t recognize the dynamically created fields?
The text was updated successfully, but these errors were encountered: