Hi Andrew,
 
when we remove the subform tags and click the links (when they are set
to immediate="true"), the input text is updated - without any change of
the backing bean or anywhere else.
 
I still consider going through all input controls and calling
"resetValue" a workaround.
 
Explanations or thoughts are very welcome.
 
Regards
Stefan

________________________________

Von: Andrew Robinson [mailto:andrew.rw.robin...@gmail.com] 
Gesendet: Freitag, 27. Februar 2009 16:25
An: MyFaces Discussion
Betreff: Re: Subform with InputText: InputText is not updated after a
page submit


Input controls will remember their submitted values until they are
cleared. Have you made sure that the input text has never posted a value
back? If so, calling resetValue() is the correct solution, and not a
work-around. 

-Andrew


On Fri, Feb 27, 2009 at 12:51 AM, <stefan.friedr...@sungard.com> wrote:


        Hi. 

        We are currently facing and "interesting" problem: 

        We have a page that contains one form element with a couple of
input elements and one subform element, the backing bean is session
scoped:

        <tr:form> 
          ... 
          <tr.commandLink text="New" .../> (--> sets backing bean
property that lets the subform be rendered with value=null) 
          <tr:subform rendered="#{backing.showSubform}"> 
            <tr:inputText value="#{backing.value}" required="true"/> 
            <tr:commandButton text="Submit" action="......"/> (To save
the value and unrender the subform) 
            <tr:commandButton text="Cancel" action="......"
immediate="true"/> (To cancel the editing and unrender the subform) 
          </tr:subform> 
          <tr:commandLink text="Edit" .../> (--> sets backing bean
property that lets the subform be rendered with value="current Value")

          <tr:commandLink text="Save".../> (Finally saves the changes) 
        </tr:form> 

        Now we have the following usecases: 
        A) OK 
        1. Form is started 
        2. "New" is clicked 
        3. subform is shown with empty inputText 

        B) OK 
        1. Form is started 
        2. "Edit" is clicked 
        3. subform is shown with "current Value" 

        C) NOT OK 
        1. Form is started 
        2. "Edit" is clicked 
        3. "New" is clicked 
        4. subform is shown with "current Value" 

        D) NOT OK 
        1. Form is started 
        2. "New" is clicked 
        3. "Edit" is clicked 
        4. subform is shown with empty inputText 


        So what are we missing here? Why is the inputText not
re-rendered (we think because the events are not produced from within
the subform)? Some debugging in the backing bean shows that the "value"
property is set correctly - its just the subform that doesn't get
updated


        What we already tried (without success): 
        - set the subform as "default" -> no change 
        - remove the subform tags -> "New" or "Edit" is not clickable
until the text field is filled (required) 
        - set immediate="true" on all relevant links -> No update of the
subform content 
        - set an id and a binding on the subform element and call
requestContext.addPartialTarget(...) from the backing bean's "new" and
"edit" methods -> No update of the subform content


        What we tried (with success): 
        - Programatically call resetValue() on all EditableComponents
from the backing bean 
        --> So this approach works but produces some overhead and is
kind of a "workaround" 

        Help is appreciated ;-) 

        Regards 
        Stefan Friedrich 


Reply via email to