3 Replies Latest reply on Aug 11, 2015 11:20 AM by Carlos Carrera

    suggestionbox not displaying, no input elements found

    Todd Bush Newbie

      Howdy,

      I've been slowly banging my head against the suggestionbox rock and finally decided to ask for help. I'm attempting to implement suggestionbox within a data table and while it appears to be working under the covers (debugging shows the backing beans are being called), the suggestion panel never appears. Using a4j:log, I can see the request and the response but I noticed forwards the end these lines:


      debug[8:20:29,720]: Hidden JSF state fields: [object HTMLSpanElement]
      debug[8:20:29,721]: Namespace for hidden view-state input fields is undefined
      debug[8:20:29,722]: search for elements by name 'input' in element span
      debug[8:20:29,727]: getElementsByTagName found 0
      debug[8:20:29,728]: Replace value for inputs: 4 by new values: 0
      debug[8:20:29,728]: search for elements by name 'INPUT' in element span
      debug[8:20:29,733]: getElementsByTagName found 0
      debug[8:20:29,734]: Replace value for inputs: 4 by new values: 0
      debug[8:20:29,735]: call getElementById for id= _A4J.AJAX.focus
      debug[8:20:29,735]: No focus information in response


      Which leads me to believe the jscript cannot find the input element to display the suggestion panel. I've tried this with RichFaces 3.1.0 and 3.1.2.GA, but with the same result. The demos work on my browsers, just not my code. Has anyone else had a similar issue?

      My env:

      JBoss 4.0.5
      JBoss Seam 1.21.GA
      RichFaces 3.1.2.GA
      Tomahawk 1.1.5

      The code:

       <body>
       <h:form id="testForm">
       <rich:dataTable id="homeMedTable"
       styleClass="data-table"
       value="#{patientAssessment.homeMeds}"
       var="med">
      
       <rich:column>
       <f:facet name="header">
       <h:outputText id="drugHeader" value="Drug"/>
       </f:facet>
       <h:panelGrid columns="1" border="0">
       <h:inputText id="drugText" value="#{med.drugName}"/>
       <rich:suggestionbox id="drugNameSuggest" for="drugText"
       suggestionAction="#{drugSearch.searchForDrug}"
       minChars="3" tokens="],"
       var="result" fetchValue="#{result.nameAndStrength}"
       height="200" width="150"
       rules="none" first="0" limitToList="true"
       shadowOpacity="4" shadowDepth="4" cellpadding="2">
       <h:column>
       <h:outputText value="#{result.nameAndStrength}"/>
       </h:column>
       </rich:suggestionbox>
       </h:panelGrid>
       </rich:column>
      
       </rich:dataTable>
      
       <a4j:log hotkey="l" popup="false" style="width: 800px; height: 300px;" level="ALL"></a4j:log>
       </h:form>
       </body>
      


      The Log output:
      debug[8:20:28,225]: set timeout for request suggestion
      debug[8:20:28,232]: Observer event occurs
      debug[8:20:28,432]: set timeout for request suggestion
      debug[8:20:28,444]: Observer event occurs
      debug[8:20:28,599]: set timeout for request suggestion
      debug[8:20:28,615]: Observer event occurs
      debug[8:20:28,616]: Call data for update choices
      debug[8:20:28,617]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: keypress
      debug[8:20:28,618]: NEW AJAX REQUEST !!! with form :testForm
      debug[8:20:28,619]: Append text control testForm:homeMedTable:0:drugText with value [Abb] and value attribute []
      debug[8:20:28,620]: Append text control testForm:homeMedTable:1:drugText with value [] and value attribute []
      debug[8:20:28,620]: Append hidden control testForm_SUBMIT with value [1] and value attribute [1]
      debug[8:20:28,621]: Append hidden control jsf_sequence with value [1] and value attribute [1]
      debug[8:20:28,622]: parameter testForm:homeMedTable:0:drugNameSuggest with value testForm:homeMedTable:0:drugNameSuggest
      debug[8:20:28,623]: parameter inputvalue with value Abb
      debug[8:20:28,624]: Start XmlHttpRequest
      debug[8:20:28,628]: Reqest state : 1
      debug[8:20:28,629]: QueryString: AJAXREQUEST=_viewRoot&testForm%3AhomeMedTable%3A0%3AdrugText=Abb&
      testForm%3AhomeMedTable%3A1%3AdrugText=&testForm_SUBMIT=1&jsf_sequence=1&
      testForm%3AhomeMedTable%3A0%3AdrugNameSuggest=testForm%3AhomeMedTable%3A0%3AdrugNameSuggest&inputvalue=Abb&
      debug[8:20:28,634]: Reqest state : 1
      debug[8:20:29,670]: Reqest state : 2
      debug[8:20:29,672]: Reqest state : 3
      debug[8:20:29,673]: Reqest state : 4
      debug[8:20:29,673]: Reqest end with state 4
      debug[8:20:29,674]: Response with content-type: text/xml;charset=UTF-8
      debug[8:20:29,675]: Full response content: <?xml version="1.0"?>
      <html xmlns="http://www.w3.org/1999/xhtml"><head><title></title>
      <link type="text/css" rel="stylesheet" href="/emeds/a4j_3_1_2.GAcss/table.xcss/DATB/eAFjlbr0AAAC6gHS.seam" />
      <link type="text/css" rel="stylesheet" href="/emeds/a4j_3_1_2.GAorg/richfaces/renderkit/html/css/suggestionbox.xcss/DATB/eAFjlbr0AAAC6gHS.seam" />
      <script type="text/javascript" src="/emeds/a4j_3_1_2.GAorg.ajax4jsf.javascript.AjaxScript.seam"> </script>
      <script type="text/javascript" src="/emeds/a4j_3_1_2.GAorg.ajax4jsf.javascript.PrototypeScript.seam"> </script>
      <script type="text/javascript" src="/emeds/a4j_3_1_2.GAorg.ajax4jsf.javascript.SmartPositionScript.seam"> </script>
      <script type="text/javascript" src="/emeds/a4j_3_1_2.GAorg/richfaces/renderkit/html/scripts/browser_info.js.seam"> </script>
      <script type="text/javascript" src="/emeds/a4j_3_1_2.GAorg/richfaces/renderkit/html/scripts/scriptaculo.js.seam"> </script>
      <script type="text/javascript" src="/emeds/a4j_3_1_2.GAorg/richfaces/renderkit/html/scripts/suggestionbox.js.seam"> </script>
      </head><body>
      <table border="0" cellpadding="0" cellspacing="0" class="dr-sb-int-decor-table rich-sb-int-decor-table "
      width="100%" id="testForm:homeMedTable:1:drugNameSuggest:suggest">
      <colgroup span="1"></colgroup>
      <tbody><tr class="dr-sb-int rich-sb-int richfaces_suggestionEntry">
      <td style="display: none;" class="richfaces_suggestionSelectValue">Abbokinase 250000 intl units</td>
      <td nowrap="nowrap" class="dr-sb-cell-padding rich-sb-cell-padding" style="padding: 2px;">Abbokinase 250000 intl units</td>
      </tr>
      <tr class="dr-sb-int rich-sb-int richfaces_suggestionEntry">
      <td style="display: none;" class="richfaces_suggestionSelectValue">Abbokinase 250000 intl units</td>
      <td nowrap="nowrap" class="dr-sb-cell-padding rich-sb-cell-padding" style="padding: 2px;">Abbokinase 250000 intl units</td></tr>
      <tr class="dr-sb-int rich-sb-int richfaces_suggestionEntry">
      <td style="display: none;" class="richfaces_suggestionSelectValue">Abbokinase Open-Cath 5000 intl units</td>
      <td nowrap="nowrap" class="dr-sb-cell-padding rich-sb-cell-padding" style="padding: 2px;">Abbokinase Open-Cath 5000 intl units</td></tr>
      <tr class="dr-sb-int rich-sb-int richfaces_suggestionEntry">
      <td style="display: none;" class="richfaces_suggestionSelectValue">Abbokinase Open-Cath 9000 intl units</td>
      <td nowrap="nowrap" class="dr-sb-cell-padding rich-sb-cell-padding" style="padding: 2px;">Abbokinase Open-Cath 9000 intl units</td>
      </tr></tbody></table>
      <meta name="Ajax-Update-Ids" content="testForm:homeMedTable:1:drugNameSuggest:suggest" />
      <span id="ajax-view-state"></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /></body></html>
      debug[8:20:29,676]: Header Ajax-Expired not found, search in <meta>
      debug[8:20:29,677]: search for elements by name 'meta' in element #document
      debug[8:20:29,683]: getElementsByTagName found 2
      debug[8:20:29,684]: Find <meta name='Ajax-Update-Ids' content='testForm:homeMedTable:1:drugNameSuggest:suggest'>
      debug[8:20:29,685]: Find <meta name='Ajax-Response' content='true'>
      debug[8:20:29,685]: Header Ajax-Update-Ids not found, search in <meta>
      debug[8:20:29,686]: search for elements by name 'meta' in element #document
      debug[8:20:29,691]: getElementsByTagName found 2
      debug[8:20:29,692]: Find <meta name='Ajax-Update-Ids' content='testForm:homeMedTable:1:drugNameSuggest:suggest'>
      debug[8:20:29,693]: search for elements by name 'script' in element #document
      debug[8:20:29,700]: getElementsByTagName found 6
      debug[8:20:29,701]: <script> in response with src=/emeds/a4j_3_1_2.GAorg.ajax4jsf.javascript.AjaxScript.seam
      debug[8:20:29,701]: Such element exist in document
      debug[8:20:29,702]: <script> in response with src=/emeds/a4j_3_1_2.GAorg.ajax4jsf.javascript.PrototypeScript.seam
      debug[8:20:29,703]: Such element exist in document
      debug[8:20:29,704]: <script> in response with src=/emeds/a4j_3_1_2.GAorg.ajax4jsf.javascript.SmartPositionScript.seam
      debug[8:20:29,704]: Such element exist in document
      debug[8:20:29,705]: <script> in response with src=/emeds/a4j_3_1_2.GAorg/richfaces/renderkit/html/scripts/browser_info.js.seam
      debug[8:20:29,706]: Such element exist in document
      debug[8:20:29,707]: <script> in response with src=/emeds/a4j_3_1_2.GAorg/richfaces/renderkit/html/scripts/scriptaculo.js.seam
      debug[8:20:29,707]: Such element exist in document
      debug[8:20:29,708]: <script> in response with src=/emeds/a4j_3_1_2.GAorg/richfaces/renderkit/html/scripts/suggestionbox.js.seam
      debug[8:20:29,709]: Such element exist in document
      debug[8:20:29,710]: search for elements by name 'link' in element #document
      debug[8:20:29,716]: getElementsByTagName found 2
      debug[8:20:29,717]: <link> in response with src=/emeds/a4j_3_1_2.GAcss/table.xcss/DATB/eAFjlbr0AAAC6gHS.seam
      debug[8:20:29,718]: Such element exist in document
      debug[8:20:29,718]: <link> in response with src=/emeds/a4j_3_1_2.GAorg/richfaces/renderkit/html/css/suggestionbox.xcss/DATB/eAFjlbr0AAAC6gHS.seam
      debug[8:20:29,719]: Such element exist in document
      debug[8:20:29,720]: call getElementById for id= ajax-view-state
      debug[8:20:29,720]: Hidden JSF state fields: [object HTMLSpanElement]
      debug[8:20:29,721]: Namespace for hidden view-state input fields is undefined
      debug[8:20:29,722]: search for elements by name 'input' in element span
      debug[8:20:29,727]: getElementsByTagName found 0
      debug[8:20:29,728]: Replace value for inputs: 4 by new values: 0
      debug[8:20:29,728]: search for elements by name 'INPUT' in element span
      debug[8:20:29,733]: getElementsByTagName found 0
      debug[8:20:29,734]: Replace value for inputs: 4 by new values: 0
      debug[8:20:29,735]: call getElementById for id= _A4J.AJAX.focus
      debug[8:20:29,735]: No focus information in response
      debug[8:20:29,736]: call getElementById for id= org.ajax4jsf.oncomplete
      debug[8:20:29,737]: Call component oncomplete function after processing updates
      debug[8:20:29,771]: call getElementById for id= _ajax:data
      debug[8:20:29,772]: AJAX response complete - updateChoices
      debug[8:20:29,776]: Choices updated
      


      Thanks for your help!!!

      Todd