7 – Adding multiple values ​​in a widget

I am working on a widget for an image field (unlimited cardinality) where I can select images attached to other nodes of another type of node. The field of the image is contained in a collection of fields, but I do not think that matters.

I have all the interface with an excellent and elegant appearance, but I can not get the save to work, I just have an additional image to save.

My list of images is a list of check boxes. I have some javascript that generate hidden fields when one of the checkboxes is checked.
For example, if I already have 4 images in my field and I check 3 additional images, I generate the following fields:




















However, only the first suparcuto puppy image is added when saving. No error message appears. Is there anything else I need to do to have Drupal save all the images?