Index: LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm
===================================================================
--- LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm	(revision 949)
+++ LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm	(revision 951)
@@ -249,8 +249,9 @@
 sub attr_field_name {
     my ($self, $attr) = @_;
-    return ($self->{object}
-            ? $self->{object}->id . '_'
-            : ''
-        ) . $attr
+    my $id = $self->{object}
+        ? $self->{object}->id . '_'
+        : '';
+    $id =~ s/\./_/g;
+    $id . $attr;
 }
 
@@ -288,6 +289,8 @@
         my $html_id = $htmlname .
             (scalar(@html_fields) ? scalar(@html_fields) : '');
+        $html_id .= 'NB' if ($attribute->multiple);
 
         my $html_field = '';
+        my $html_ref = '';
         for ($attribute->form_type) {
             /^textarea$/i and do {
@@ -403,7 +406,7 @@
                 }
                 if ($attribute->uniq) {
-                    $html_field .= qq|<span class="inputvalidate" id="${html_id}_observer_uniq"></span>|;
-                    $html_field .= "\n";
-                    $html_field .= $self->{c}->prototype->observe_field(
+                    $html_ref .= qq|<span class="inputvalidate" id="${html_id}_observer_uniq"></span>|;
+                    $html_ref .= "\n";
+                    $html_ref .= $self->{c}->prototype->observe_field(
                         $html_id,
                         {
@@ -418,5 +421,5 @@
                         }
                     );
-                    $html_field .= qq|<span style="display:none" id="${html_id}_stat">Searching...</span>|;
+                    $html_ref .= qq|<span style="display:none" id="${html_id}_stat">Searching...</span>|;
                 }
                 last;
@@ -439,5 +442,5 @@
                 }
                 
-                $html_field .= $self->{c}->prototype->observe_field( $html_id, {
+                $html_ref .= $self->{c}->prototype->observe_field( $html_id, {
                         update => "${html_id}_span",
                         url => $self->{c}->uri_for('/ajax', 'rawattr', $ref),
@@ -453,9 +456,9 @@
                 )
             }
-            $html_field .= sprintf(qq{<span id="%s" style="margin-left: 1em">},
+            $html_ref .= sprintf(qq{<span id="%s" style="margin-left: 1em">},
                 "${html_id}_span");
 
             if (defined($text)) {
-                $html_field .= $uri_part
+                $html_ref .= $uri_part
                     ? sprintf('<a href="%s">%s</a>',
                         $self->{c}->uri_for("/$uri_part", $attribute->display($attr_raw_value)),
@@ -464,7 +467,43 @@
             }
 
-            $html_field .= "</span>\n";
+            $html_ref .= "</span>\n";
         }
-        push(@html_fields, $html_field);
+        push(@html_fields, $html_field . $html_ref);
+        if ($attribute->{multiple} && (!$attr_raw_value)) {
+            my $esc_html_field = $html_field;
+            my $esc_html_ref = $html_ref;
+            $esc_html_ref =~ s/'/\\'/g;
+            #$esc_html_field =~ s/"/\\"/g;
+            my $addempty = sprintf(
+                '<div id="%s"></div>',
+                "${html_id}_mul_emp0",
+            );
+            $addempty .= sprintf(qq#
+            <script type="text/javascript">
+                var cn_${html_id} = 0;
+                function add_${html_id} () {
+                    cn_${html_id}++;
+                    var cn = cn_${html_id};
+                    var htmlid = '${html_id}'.replace(/NB/g, cn);
+                    document.getElementById('${html_id}_mul_emp' + (cn - 1)).innerHTML +=
+                        '%s<span class="inputvalidate" id="${html_id}_observer_uniq"></span><br>'.replace(/NB/g, cn);
+                    document.getElementById('${html_id}_mul_emp' + (cn - 1)).innerHTML += 
+                        '<div id="${html_id}_mul_emp' + cn + '"></div>';
+
+                    new Form.Element.Observer( '${html_id}'.replace('NB', cn),
+                           2,
+                           function( element, value ) {
+                                new Ajax.Updater( '${html_id}_observer_uniq'.replace(/NB/g, cn), 
+                                    'http://localhost:8080/ajax/objattrexist/nethost/cname',
+                                    { parameters: 'val='+document.getElementById(htmlid).value+'&exclude=$attr_raw_value',asynchronous: 1 } ) 
+                            } );
+                }
+            </script>
+            <button type="button" onclick="add_${html_id}()">+</button>
+            #,
+            $esc_html_field
+            );
+            push(@html_fields, $addempty);
+        }
     }
     return join("<br>\n", @html_fields);
@@ -495,5 +534,5 @@
     my ($self, $attrs) = @_;
     $self->{c}->req->param($self->label) || $attrs or return;
-    my $prefix = $self->{object}->id . '_';
+    my $prefix = $self->attr_field_name('');
     my %fields;
     foreach ($attrs ? @{ $attrs } : $self->write_attributes) {
