web/data/cubicweb.ajax.box.js
branchstable
changeset 6987 d62d4ba5ef3e
parent 6947 3d72028a6cd4
child 8260 5a81fa526b30
--- a/web/data/cubicweb.ajax.box.js	Fri Feb 11 16:45:43 2011 +0100
+++ b/web/data/cubicweb.ajax.box.js	Mon Feb 14 09:37:17 2011 +0100
@@ -37,6 +37,26 @@
     });
 }
 
+/**
+ * .. function:: ajaxBoxShowSelector(boxid, eid, unrelfname,
+ *                                  addfname, msg,
+ *                                  oklabel, cancellabel,
+ *                                  separator=None)
+ *
+ * Display an ajax selector within a box of regid `boxid`, for entity with eid
+ * `eid`.
+ *
+ * Other parameters are:
+ *
+ * * `addfname`, name of the json controller method to call to add a relation
+ *
+ * * `msg`, message to display to the user when a relation has been added
+ *
+ * * `oklabel`/`cancellabel`, OK/cancel buttons label
+ *
+ * * `separator`, items separator if the field is multi-valued (will be
+ *   considered mono-valued when not specified)
+ */
 function ajaxBoxShowSelector(boxid, eid,
                              unrelfname,
                              addfname, msg,
@@ -59,11 +79,11 @@
                     ajaxBoxValidateSelectorInput(boxid, eid, separator, addfname, msg);
                 }
             });
-            $input.cwautocomplete(unrelated, {multiple: true});
+            $input.cwautocomplete(unrelated, {multiple: Boolean(separator)});
             var buttons = DIV({'class' : "sgformbuttons"},
                               A({href : "javascript: noop();",
                                  onclick : cw.utils.strFuncCall('ajaxBoxValidateSelectorInput',
-                                                                  boxid, eid, separator, addfname, msg)},
+                                                                boxid, eid, separator, addfname, msg)},
                                 oklabel),
                               ' / ',
                               A({'href' : "javascript: noop();",