Hi!

Happy new year :)


Here are the code snippets:

--------------
The JSF page:
--------------
...

<h:form>

...

<%-- the inputTextarea which is rendered empty again after the JSF page is
redisplayed --%>
    <h:panelGroup>
      <h:outputLabel for="fragetext"
        value="Frage*: "
        styleClass="formLabelTop"
        lang="de"
        title="Textfeld zur Eingabe der Frage" />
      <t:inputTextarea id="fragetext"
        value="#{EinfAuswFrageBacking.einfAuswFrage.fragetext}"
        required="true"
        cols="100"
        rows="3"
        title="Textfeld zur Eingabe der Frage">
        <f:validateLength maximum="256" />
      </t:inputTextarea>
      <f:verbatim><br/></f:verbatim>
      <h:message for="fragetext"
        styleClass="error"
        lang="de"
        title="Fehlermeldung für das Frage Textfeld" />
    </h:panelGroup>

<%-- the selectBooleanCheckbox which is rendered empty again after the JSF
page is redisplayed --%>
        <h:panelGroup>
      <h:outputLabel for="mussFrage" value="Antwort erforderlich: "
        styleClass="formLabel"
        lang="de"
        title="Auswahlfeld zur Angabe, ob die Antwort erforderlich ist" />
      <t:selectBooleanCheckbox id="mussFrage"
        value="#{EinfAuswFrageBacking.einfAuswFrage.mussFrage}"
        required="false"
        lang="de"
        title="Auswählen, falls Antwort erforderlich" />
      <h:outputText escape="false" value="&nbsp;Ja, Frage muss beantwortet
        werden"
        styleClass="formText"
        lang="de"
        title="Auswählen, falls Antwort erforderlich" />
    </h:panelGroup>

<%-- the selectOneRadio which is rendered empty again after the JSF page is
redisplayed --%>
        <h:panelGrid columns="1">
      <t:column>
        <h:outputLabel for="auswMoeglichkeitRadios"
          value="Auswahlmöglichkeiten anzeigen:"
          styleClass="formLabel"
          lang="de"
          title="Anzeigeeigenschaften der Auswahlmöglichkeiten" />
        <f:verbatim><br/></f:verbatim>
        <t:selectOneRadio id="auswMoeglichkeitRadios"
          value="#{EinfAuswFrageBacking.auswMoeglichkeitOpt}"
          required="true"
          layout="spread"
          styleClass="formText"
          lang="de"
          title="Radiobuttons zur Auswahl der Anzeigeeigenschaften der
            Auswahlmöglichkeiten">
          <f:selectItems
            value="#{EinfAuswFrageBacking.auswMoeglichkeitOptions}" />
      </t:selectOneRadio>
      </t:column>

<%-- the inputText which is NOT rendered empty again after the JSF page is
redisplayed (the value entered is rendered) --%>
      <t:column>
        <t:radio for="auswMoeglichkeitRadios" index="0" />
        <t:inputText id="anzahlSpalten"
          binding="#{EinfAuswFrageBacking.inputTextAnzahlSpalten}"
          value="#{EinfAuswFrageBacking.einfAuswFrage.spalten}"
          required="false"
          readonly="false"
          disabled="false"
          maxlength="2"
          size="2"
          title="Textfeld zur Eingabe der Spaltenanzahl"
          immediate="false">
          <f:validateLongRange minimum="1" maximum="12" />
        </t:inputText>
        <h:outputText escape="false"
          value="&nbsp;(1 bis 12)"
          styleClass="formText"
          lang="de"
          title="Zahlenbereich ist 1 bis 12" />
        <f:verbatim><br/></f:verbatim>
        <h:message for="anzahlSpalten"
          styleClass="error"
          lang="de"
          title="Fehlermeldung für das Spaltenanzahl Textfeld" />
      </t:column>

      <t:column>
        <t:radio for="auswMoeglichkeitRadios" index="1" />
      </t:column>
    </h:panelGrid>


<%-- the dataTable from which rows are deleted with the button below --%>
    <t:dataTable id="dataTableAuswahlmoeglichkeiten"
      binding="#{EinfAuswFrageBacking.dataTable}"
      value="#{EinfAuswFrageBacking.auswMoeglichkeitenModel}"
      var="row"
      renderedIfEmpty="true"
      preserveDataModel="false">

      <t:column width="30">
        <t:selectBooleanCheckbox binding="#{EinfAuswFrageBacking.checkbox}"
          required="false"
          lang="de"
          title="Auswahlmoeglichkeit auswählen zum Löschen"
          immediate="false" />
      </t:column>

     ...

    </t:dataTable>


<%-- the action button to delete rows with --%>
    <h:commandButton value="Auswahl Entfernen"
      action="#{EinfAuswFrageBacking.deleteAuswMoeglichkeiten}"
      immediate="true" />

...

</h:form>

...

-----------------------------------------------------------------
The action method of the EinfAuswFrageBacking.java Backing-Bean:
-----------------------------------------------------------------

public String deleteAuswMoeglichkeiten() {
    List toDelete = this.getSelectedAuswMoeglichkeiten();
    Iterator it = toDelete.iterator();

    while (it.hasNext()) {
      this.auswMoeglichkeitenList.remove(it.next());
    }


    int size = this.auswMoeglichkeitenList.size();
    for (int i = 0; i < size; i++) {
      Auswahlmoeglichkeit am =
(Auswahlmoeglichkeit)this.auswMoeglichkeitenList
        .get(i);

      am.setAuswahlindex(new Integer(i + 1));
    }


    this.checkbox.setSelected(false);

    return Constants.ACTION_SUCCESS;
  }


----------------
faces-config.xml:
----------------

<navigation-rule>
        <from-view-id>/Management/Fragen/EinfAuswFrage.jsp</from-view-id>
        <navigation-case>
                
<from-action>#{EinfAuswFrageBacking.deleteAuswMoeglichkeiten}</from-action
>
                <from-outcome>success</from-outcome>
                <to-view-id>/Management/Fragen/EinfAuswFrage.jsp</to-view-id>
        </navigation-case>
</navigation-rule>



By the way: the inputTextarea is not the only component which is rendered
empty when the page is redisplayed after submitting it non-empty - it also
happens to the selectBooleanCheckbox, and to the selectOneRadio, but not to
the inputText, which renders the value entered before submitting the page
(In my last email, I spuriously wrote that the inputText is rendered empty,
but it actually was an inputTextarea!).


Regards,

Matthias

> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Auftrag
> von Volker Weber
> Gesendet: Samstag, 31. Dezember 2005 13:22
> An: MyFaces Discussion
> Betreff: Re: AW: EditableValueHolder rendering behavior / Restore View
>
>
> Hi,
>
> Matthias, can you post the relevant jsf code, and the
> action/actionListener code?
>
> This may help us to see what's wrong.
>
> Regards
>   Volker
>
> Matthias Kahlau wrote:
> > Hi Simon,
> >
> >
> >>Perhaps your button is inside a different form from the one containing
> >>your input text? HTML only supports submitting one form, so all
> >>components in other forms will see their input as missing, ie will have
> >>their submitted value reset..
> >
> >
> > Actually not - all components are contained in the same form....
> >
> > Looks buggy....
> >
> >
> > Regards,
> >
> > Matthias
> >
> >
> >
> >>-----Ursprüngliche Nachricht-----
> >>Von: [EMAIL PROTECTED]
> >>[mailto:[EMAIL PROTECTED] Auftrag
> >>von Simon Kitching
> >>Gesendet: Samstag, 31. Dezember 2005 05:33
> >>An: MyFaces Discussion
> >>Betreff: Re: EditableValueHolder rendering behavior / Restore View
> >>
> >>
> >>Matthias Kahlau wrote:
> >>
> >>>Hi all!
> >>>
> >>>
> >>>I have an non-immediate inputText in my form, and an immediate
> >>
> >>commandButton
> >>
> >>>to delete some selected rows in a table. When the user enters
> >>
> >>some text in
> >>
> >>>the inputText and deletes some rows after that, the same JSF page is
> >>>redisplayed, but the inputText is empty again. Why isn't the
> >>
> >>submitted value
> >>
> >>>of the inputText rendered?
> >>
> >>It will be in the usual case.
> >>
> >>Perhaps your button is inside a different form from the one containing
> >>your input text? HTML only supports submitting one form, so all
> >>components in other forms will see their input as missing, ie will have
> >>their submitted value reset..
> >>
> >>Regards,
> >>
> >>Simon
> >
> >
>
> --
> Don't answer to From: address!
> Mail to this account are droped if not recieved via mailinglist.
> To contact me direct create the mail address by
> concatenating my forename to my senders domain.

Reply via email to