Okay, I am once again doing something abnormal.
I have a form with many fields. Several fields at the top are required
and have validators on them. Several of these fields I can
auto-populate if the user picks an object from a dialog (search
dialog). Process:
* User loads page
* User fills some information in
* User clicks button that loads a dialog and chooses an item from a search form
* I take the selected object and populate my backing bean with the information
* (Problem:) The fields on the form are not updated, they keep their
current submitted values
Code (simplified example):
<ts:subForm id="outerForm">
<t:inputText id="test" value="#{mybean.myvalue}" required="true" />
<ts:subForm id="applyForm">
<t:commandLink
actionFor="applyForm"
value="update" />
</ts:subForm>
</ts:subForm>
The link executes fine, the bean is updated, but the "test"
component's value on the client is not changed. It is still blank
(value was null on first page rendering). I know I could probably
write a custom UIInput component that would "forget" its submitted
value and use the value instead on re-render, but that is quite a bit
of work, especially if I end up adding more controls than just an
input text.
FYI, I had the code in a sub-form to avoid the validation errors on
the 'test' component when I click update.
Has anyone successfully implemented this type of solution (popup
search dialog to pull in values)?
Another solution that comes to mind is JavaScript (take the values
from the popup window, search for the controls on window.opener and
then set their values, but this is messy and since my popup is
actually a jenia popup frame that uses IFRAME, I wonder if I'd get JS
security issues with this approach).
One other solution I suppose is to use component binding and clear the
submitted values on the component (or set them to the bean values).
This one I may go with (if it works, haven't tried it yet).
Any ideas of a simpler way that I am missing?
Thanks,
Andrew