cancel
Showing results for 
Search instead for 
Did you mean: 

Share : autocomplete in datalists

philippe
Champ on-the-rise
Champ on-the-rise
Hello,

I have tried the autocomplete control in share. It works well when I edit entities from the "Edit Metadata" page.

But when I use it in DataList, it doesn't work (when I add a new row).

It seems that the contructor YAHOO.widget.AutoComplete doesn't find the input controls, the call YAHOO.util.Dom.inDocument(elInput) returns always false.

some code from the autoComplete.ftl :
new YAHOO.widget.AutoComplete("${fieldHtmlId}", "${fieldHtmlId}-container", oDS);

some code from the autoComplete.js :
YAHOO.widget.AutoComplete = function(elInput,elContainer,oDataSource,oConfigs) {

// Validate input element
        if(YAHOO.util.Dom.inDocument(elInput)) {…}

}

I would like to have the autocomplete in datalist as well as in "Edit Metadata" page.
Has anyone run into this problem, and found a solution ?


Thank you
4 REPLIES 4

smicyk
Champ in-the-making
Champ in-the-making
Hi,

I have similar issue when using workflows task dialogs. The control for autocomplete doesn't exists so function return. My solution is to change implementation of autocomplete.ftl so that code of autocomplete is loaded when element is ready. It looks like:


<script type="text/javascript">//<![CDATA[
(function()
{
   var element = new YAHOO.util.Element("${fieldHtmlId}");
   
   element.on('contentReady', function() {
      // Use an XHRDataSource
      var oDS = new YAHOO.util.XHRDataSource("${url.context}${ds}");
  
         // Set the responseType
         oDS.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
  
         // Define the schema of the JSON results
         oDS.responseSchema =
         {
            resultsList : "result",
            fields : ["value"]
         };
  
         // Instantiate the AutoComplete
         var oAC = new YAHOO.widget.AutoComplete("${fieldHtmlId}", "${fieldHtmlId}-container", oDS);
  
         // Throttle requests sent
         oAC.queryDelay = .5;
  
         // The webservice needs additional parameters
         oAC.generateRequest = function(sQuery)
         {
            <#if ds?contains("?")>
               return "&q=" + sQuery;
            <#else>
               return "?q=" + sQuery;
            </#if>
         };
  
         return {
            oDS: oDS,
            oAC: oAC
         };   
   });
})();
//]]></script>

I don't know if it is best solution but it works quite good.

Thanks
smicyk

flopez
Champ in-the-making
Champ in-the-making
Hello Phillipe! did you find a solution for this? would you mind to share how to make the autocomplete feature work? I'm working on this exact same functionality but can't get it to work. any info would be greatly appreciated, thanks!

philippe
Champ on-the-rise
Champ on-the-rise
Hello,

You can download an autocomplete control that works with datalist on our website: http://www.becpg.net/contribs

Best regards.

applelam
Champ in-the-making
Champ in-the-making
Hello Philippe,

Can you autocomplete form creator… like this: https://www.youtube.com/watch?v=Z9V__nNWJb0
using becpg?
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.