-
1. Re: The value of one h:inputText becomes the default for ano
sergeysmirnov Feb 10, 2009 2:57 PM (in response to mangelo123)Do you mean you want to re-render the second input based on the value of the first input?
If so, read this article from the RichFaces cookbook:
http://www.jboss.org/community/docs/DOC-11866 -
2. Re: The value of one h:inputText becomes the default for ano
mangelo123 Feb 10, 2009 3:25 PM (in response to mangelo123)I've read that article before, but honestly it doesn't say much about what I need. That's just my opinion though.
-
3. Re: The value of one h:inputText becomes the default for ano
thomas.m Feb 10, 2009 4:23 PM (in response to mangelo123)I don't understand, do you want the second input to be filled on the fly as the user is typing, or filled when the focus is lost on the first input, or something else maybe ?
-
4. Re: The value of one h:inputText becomes the default for ano
mangelo123 Feb 10, 2009 4:29 PM (in response to mangelo123)Either on the fly or after focus is lost. The more common way to do this is on most shopping sites you click a checkbox that says "Shipping is the same as billing" or whatever. You click the button and it copies the address. I thought RichFaces would provide a slick way to do it either on the fly or on focus lost.
-
5. Re: The value of one h:inputText becomes the default for ano
nbelaevski Feb 10, 2009 6:11 PM (in response to mangelo123)Hello,
Try this:<h:inputText value="#{bean.property1}"> <a4j:support event="onblur" action="#{bean.copyProperties}" reRender="secondInput" /> </h:inputText> <h:inputText id="secondInput" value="#{bean.property2}" />
#{bean.copyProperties} - is an action method that would copy data from property1 to property2. -
6. Re: The value of one h:inputText becomes the default for ano
mangelo123 Feb 10, 2009 7:07 PM (in response to mangelo123)This is practically what I am looking for. Only 1 flaw with this approach and I really am not sure of a way around it.
I'll need an action method or each input control. I ran this code thru a debugger and there's not a clear way to generically copy the contents of the source to the destination.
I was able to find the name of the source (ie 'address') and from that I could form the destination, but then how do I get a handle to 'billingAddress' for example?
TIA -
7. Re: The value of one h:inputText becomes the default for ano
mangelo123 Feb 10, 2009 7:14 PM (in response to mangelo123)It says I can edit my messages, but can't find where I do that.
The previous post should say:
I'll need an action method for each input control. -
8. Re: The value of one h:inputText becomes the default for ano
nbelaevski Feb 11, 2009 8:16 AM (in response to mangelo123)You can create map of command objects: http://en.wikipedia.org/wiki/Command_pattern and call the necessary one.