1 Reply Latest reply on Jul 27, 2009 3:31 AM by Ilya Shaikovsky

    How to reset input value for suggestionbox

    quinten jiang Newbie

      Hi,

      I have two types of input text with suggestionbox. when I switch other type and try to clear input text;which no work.

      my code is following:

      my question:

      (1) when I click radio, it seem no pass front side input value into back
      (2) When I click radio and set vehid as empty from back end, it can not clear input value in the front side

      (3) I try to implement it with javascript, and put onclick; which did not work because it seem conflict with ajax. like:

      <h:selectOneRadio id="RadioInput1" onclick="clear()" > <a4j:support event="onclick" reRender="vehgrp"/>
       <f:selectItem itemValue="Vehicle" itemLabel="Vehicle"/>
       <f:selectItem itemValue="Group" itemLabel="Group"/>
      </h:selectOneRadio>


      someone can help with these? thanks

      1. front side:
      <td width="220">
       <a4j:outputPanel id="vehgrp" layout="block">
       <h:panelGrid id="vehg" columns="2" border="0" cellpadding="0" cellspacing="0">
       <h:inputText style="margin:0px;font-size:12px; width:120px;" value="#{generateReport.vehId}" id="vehId" />
       <h:graphicImage value="/images/arrow.png" onclick="#{rich:component('suggestion')}.callSuggestion(true)" alt="" />
      </h:panelGrid>
       <rich:suggestionbox for="vehId" tokens=",[" rules="none" id="suggestion" suggestionAction="#{generateReport.autocomplete}" var="result"fetchValue="#{result.vehNo}" minChars="1" shadowOpacity="2"border="1" width="200" height="150">
      <h:column>
      <h:outputText value="#{result.vehNo}" />
      </h:column>
      </rich:suggestionbox>
      </a4j:outputPanel>
      
      <h:selectOneRadio id="RadioInput1" value="#{generateReport.inpTpValue}" valueChangeListener="#{generateReport.inpTpChange}" rendered="#{generateReport.groupEnabled}" > <a4j:support event="onclick" reRender="vehgrp"/>
       <f:selectItem itemValue="Vehicle" itemLabel="Vehicle"/>
       <f:selectItem itemValue="Group" itemLabel="Group"/>
       </h:selectOneRadio>
      

      My backend code:
      public void inpTpChange(ValueChangeEvent event) {
       inpTpValue = (String) event.getNewValue();
       this.setVehId(""); }
      


      Updated. Use code tags!