4 Replies Latest reply on Feb 4, 2009 6:47 AM by Luigi Fugaro

    Clearing inputText

    Luigi Fugaro Newbie

      Hi to all, I'm new in the Forum and I'm new to JBossRichFaces.

      Here is my problem:
      I have a suggestionBox, called SB1, that works fine, it shows me the list, and as I click on the item, the value goes to the associated inputText, named IT1.
      I have another suggestionBox, called SB2, that works exactly like SB1, obviously with a different list and a different inputText (named IT2).
      My problem is that when I choose an item on SB1, I want my IT2 cleared and vice-versa, when I choose an item on SB2 I want my IT1 cleared...

      I googled around, my I could not find any helpfull information or docs.

      Any ideas, advice, suggestion???

      Kindly,
      Luigi

      P.S. Don't ask for Mario!

        • 1. Re: Clearing inputText
          Ilya Shaikovsky Master

          you could use onselect attribute on the suggestion defined for example with something like next code:

          onselect="{rich:element('input2Id')}.value=''; "
          
          
          
          


          • 2. Re: Clearing inputText
            Luigi Fugaro Newbie

            Thanks for answering Ilya!

            Your code works fine, but I think I have another problem.

            Here is my code:

            <h:inputText id="inputText1" />
            <rich:suggestionbox for="inputText1" suggestionAction="#{myService.getListCodePV}" var="pv" onselect="#{rich:element('inputText2')}.value='';" minChars="3">
            <h:column>
            <h:outputText value="${pv.codePV}"/>
            </h:column>
            <a4j:support event="onselect" >
            <f:setPropertyActionListener value="#{pv.id}" target="#{myModel.id}" />
            </a4j:support>
            </rich:suggestionbox>
            
            <h:inputText id="inputText2" />
            <rich:suggestionbox for="inputText2" suggestionAction="#{myService.getListDescPV}" var="pv" onselect="#{rich:element('inputText1')}.value='';" minChars="3">
            <h:column>
            <h:outputText value="${pv.descPV}"/>
            </h:column>
            <a4j:support event="onselect" >
            <f:setPropertyActionListener value="#{pv.id}" target="#{myModel.id}" />
            </a4j:support>
            </rich:suggestionbox>
            


            I think that the a4j:support event="onselect" ... goes in conflict with rich:suggestionbox onselect="..."

            It seems like I have to choose only one of them.

            Thanks for your help,
            Luigi

            "ilya_shaikovsky" wrote:
            you could use onselect attribute on the suggestion defined for example with something like next code:

            onselect="{rich:element('input2Id')}.value=''; "
            




            • 3. Re: Clearing inputText
              Ilya Shaikovsky Master

              ok :) not a problem. just move the code I mentioned to onsubmit of the support.

              • 4. Re: Clearing inputText
                Luigi Fugaro Newbie

                 

                "ilya_shaikovsky" wrote:
                ok :) not a problem. just move the code I mentioned to onsubmit of the support.


                PERFETTO!!!

                Thank you very very much!!![/img]