Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery "autocomplete" doesn't work
    primarykey
    data
    text
    <p>The JQuery autocomplete code seems correct, but, does not work.</p> <p>The code seems simple enough, and I did not see any javascript errors using "Developer tools" in IE8, or the "firebug" tool in FireFox...</p> <p>But, nothing "drops down" from the listbox when a letter (e.g., "a") is typed into the input field...</p> <p>Please let me know if you can see anything amiss. I apparently am not "seeing the forest for the trees" at this point.</p> <p><strong>Here is the snippet from the definition of the JSF "Composite Component"...</strong> <code></p> <pre><code> &lt;!-- INTERFACE --&gt; &lt;cc:interface&gt; &lt;cc:attribute name="idpref" required="true"/&gt; &lt;cc:attribute name="items" required="true"/&gt; &lt;/cc:interface&gt; &lt;!-- IMPLEMENTATION --&gt; &lt;cc:implementation&gt; &lt;!-- here is the input field --&gt; &lt;h:inputText type="text" id="#{cc.attrs.idpref}"/&gt; &lt;!-- here is the javascript --&gt; &lt;h:outputScript library="js" name="jquery-1.7.2.js" /&gt; &lt;h:outputScript library="js" name="jquery-ui-1.8.21.custom.js" /&gt; &lt;script type="text/javascript" &gt; var jq = jQuery.noConflict(); jq(document).ready(function() { jq(function() { var list = #{cc.attrs.items}; var id = "#{cc.attrs.idpref}"; var prependedid = jq('input[id$="' + id + '"]').attr("id"); var comboid = "#" + prependedid; jq(comboid).autocomplete({ source: list }); }); }); &lt;/script&gt; &lt;/cc:implementation&gt; </code></pre> <p></code></p> <p><strong>Here is snippet of view tag contents from the page where the above composite component is used...</strong></p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:util="http://java.sun.com/jsf/composite/util" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core"&gt; &lt;f:view contentType="text/html"&gt; &lt;h:head&gt; &lt;title&gt;testx&lt;/title&gt; &lt;meta charset="utf-8" /&gt; &lt;/h:head&gt; &lt;h:body prependid="false"&gt; &lt;h:form id="form1" prependId="false"&gt; &lt;util:autoComplete prependId="false" idpref="aaa" items="#{refDataController.data}" /&gt; &lt;/h:form&gt; &lt;/h:body&gt; &lt;/f:view&gt; &lt;/html&gt; </code></pre> <p><strong>Here is the backend java snippet...</strong></p> <pre><code> package aaa.bbb.ccc.war; import java.util.Arrays; import java.util.List; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @Component("refDataController") @Scope("request") public class RefDataController { public RefDataController() { } private List data = Arrays.asList ("\"Aman\"", "\"Albela\"", "\"Ali\"", "\"Ankit\"", "\"Azam\"", "\"Aryan\""); public List getData() { return data; } } </code></pre> <p>Thank you for any assistance!</p> <p>sd</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload