diff -r 2f4a7d1e15b3 -r eb2ba251f093 web/data/cubicweb.ajax.box.js --- a/web/data/cubicweb.ajax.box.js Mon Feb 14 09:38:03 2011 +0100 +++ b/web/data/cubicweb.ajax.box.js Mon Feb 14 17:47:15 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();",