How to access the current Value of a component using rich:co
shino Sep 21, 2009 8:45 AMHi there,
I have a form with multiple h:inputText components inside, now I want to implement a quick search feature in such a way that there is a search button next to every inputText. The way things should work is that the user can either complete the form manually or fill one of the fields and click on the search icon. The input on that field should than be used as search criteria.
Here is a quick draft on what the original form looks like
<h:form> <h:inputText id="INPUT_NAME" value="#{bean.name}" /> <h:inputText id="INPUT_STREET" value="#{bean.street}"/> <h:inputText id="INPUT_PHONE" value="#{bean.phone}"/> <h:commandButton action="bean.submit" /> </form>
and here is what I think might be a solution (though I can't get it to work)
<h:form> <h:inputText id="INPUT_NAME" value="#{bean.name}" /> <a4j:commandLink action="#{searchBean.submit}" immediate="true" oncomplete="Richfaces.showModalPanel('#{searchBean.resultModalID}');" reRender="#{searchBean.modalID}"> <f:setPropertyActionListener value="#rich:clientId('INPUT_NAME')}.component.value" target="#{searchBean.searchInput}" /> </a4j:commandLink> <h:inputText id="INPUT_STREET" value="#{bean.street}"/> <a4j:commandLink action="#{searchBean.submit}" immediate="true" oncomplete="Richfaces.showModalPanel('#{searchBean.resultModalID}');" reRender="#{searchBean.modalID}"> <f:setPropertyActionListener value="#rich:clientId('INPUT_STREET')}.component.value" target="#{searchBean.searchInput}" /> </a4j:commandLink> <h:inputText id="INPUT_PHONE" value="#{bean.phone}"/> <a4j:commandLink action="#{searchBean.submit}" immediate="true" oncomplete="Richfaces.showModalPanel('#{searchBean.resultModalID}');" reRender="#{searchBean.modalID}"> <f:setPropertyActionListener value="#rich:clientId('INPUT_PHONE')}.component.value" target="#{searchBean.searchInput}" /> </a4j:commandLink> <h:commandButton action="bean.submit" /> </form>
I think I'm doing something wrong with the rich:clientID-Stuff, I'd be great if someone could give me some advice as to what I'm doing wrong.
Thanks in advance!
chris
P.S.: I might have missed it, but is there a list of functions that I can call using the rich:component('id') shortcut? I know there is for example rich:component('id').show() but what else can I do here?