0
votes

This gets me every time.

I want to edit the viewScope components and then use the results elsewhere - but in this simple example the computed field does not update .... what is the best way to do this? Thanks

 <xp:this.beforePageLoad><![CDATA[#{javascript:viewScope.Test = [];
viewScope.Test.push("Hello");
viewScope.Test.push("Go");
viewScope.Test.push("Hello1");}]]></xp:this.beforePageLoad>
    <xp:repeat id="repeat1" rows="30" value="#{viewScope.Test}"
        var="row" indexVar="i">
        <xp:inputText id="inputText1" value="#{row}">

            <xp:eventHandler event="onchange" submit="true"
                refreshMode="partial" refreshId="computedField1"></xp:eventHandler>
        </xp:inputText>
    </xp:repeat>

    This is new data
    <xp:text escape="true" id="computedField1"
        value="#{viewScope.Test}">
    </xp:text>
1

1 Answers

2
votes

Fixed it by changing the value of inputText to "#{viewScope.Test[i]}"

    <xp:this.beforePageLoad><![CDATA[#{javascript:
    viewScope.Test = ["Test","Test1","Test2"];
}]]></xp:this.beforePageLoad>


    <xp:repeat id="repeat1" rows="30" value="#{viewScope.Test}"
        var="row" indexVar="i">
        <xp:inputText id="inputText2" value="#{viewScope.Test[i]}">


        <xp:eventHandler event="onchange" submit="true"
            refreshMode="partial" refreshId="computedField1">
        </xp:eventHandler></xp:inputText>
    </xp:repeat>
    <xp:br></xp:br>This is new data
<xp:text escape="true" id="computedField1" value="#{viewScope.Test}"></xp:text>