I think something like that would work (from memory without having verified this JS): ( function MySuggest(element) { if (!element.suggest) { element.suggest = new XWiki.widgets.Suggest(element, { script: '$xwiki.getURL("${doc.space}.WebHome", "view")?xpage=suggest&classname=XWiki.TagClass&fieldname=tags&secCol=-&', varname: "input", seps: " ,|", offsety: 13 }); } } document.observe('dom:loaded', function () { if($('myinput1')) Event.observe($('myinput1'), "focus", MySuggest); if($('myinput2')) Event.observe($('myinput2'), "focus", MySuggest); })(); Maybe some JS wizard can verify it Ludovic Le 10/12/10 14:42, Menso Heus a écrit :
Hello everyone,
I've created a form which needs to use autosuggest for fields. The form structure is basically a list of 10 things each of which has a supplier and a product. The supplier and product field are text input, and need to use autosuggest for pagenames from a specific space.
I've been able to make the code from the Autosuggest widget work, which can be found here: http://platform.xwiki.org/xwiki/bin/view/DevGuide/AutoSuggestWidget
I'm trying to translate the javascript offered there in the second codeblock on the page to a more generic function so I can say if the input is X, call suggestSupplier and if it is y call suggestProduct.
All the supplier fields end in _Supplier in their name and all the product fields end in _SoftProd
So far, I've been unsuccessful and I don't quite understand the structure of this javascript offered. Has someone already done this before and can they give me a pointer?
Much appreciated,
Menso _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Ludovic Dubost Blog: http://blog.ludovic.org/ XWiki: http://www.xwiki.com Skype: ldubost GTalk: ldubost