What scope is your controller bean? Sent from my iPhone
On Aug 24, 2011, at 8:58 AM, JTom <[email protected]> wrote: > > Hey everybody, > > I have a problem with disabled components (especially textfields) in MyFaces > Trinidad 1.2. > > My page loads initially all my textfields with disabled="false". > After clicking a (enabled) button to "unlock" the textfield-component (now > ... disabled="false") the page > reloads with the enabled textfields. Now I would like to type some text in > it and click a "save"-Button to save the information of the > model-managedbean. But this last step doesnt work! :-( > The set-method of the model is never called (I checked this in debug-mode) > when I try to save the information of my modelBean. The get-methods delivers > the unchanged original values. > > When I initally load the page with textfields disabled="false" and switch it > to true (by button click of course) and back to false, the set-method of > the model will be called. Its just a problem when I try to initially load > the textfields disabled="true". It seems to me, after PPR the component is > not "linked" to the value in the modelBean. > > Has anyone a idea to solve this problem? > > > > public class Controller { > private boolean isDisabled = true; > > public boolean getIsDisabled(){ > return isDisabled; > } > > public String switchVisibility(ActionEvent event){ > isDisabled=false; > return "refresh"; > } > public String save(ActionEvent event){ > Model modelBean = (Model > )FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("model"); > > [...] > > serviceLayerBean.saveText(modelBean.getText1()); > > [...] > > } > > } > > public class Modell{ > > private String text1 = ""; > private String text2 = ""; > private String text3 = ""; > > public String getText1(){ > return text1; > } > public String getText2(){ > return text1; > } > public String getText3(){ > return text1; > } > > public void setText1(String text1){ > this.text1 = text1; > } > public void setText2(String text2){ > this.text2 = text2; > } > public void setText3(String text3){ > this.text3 = text3; > } > > } > > <tr:inputText id="text1" disabled="#{controllerBean.isDisabled}" > value="modelBean.text1"> > <tr:inputText id="text2" disabled="#{controllerBean.isDisabled}" > value="modelBean.text2"> > <tr:inputText id="text3" disabled="#{controllerBean.isDisabled}" > value="modelBean.text3"> > <tr:commandButton id="switchButton" text="Switch" > actionListener="#{controllerBean.switchVisibility}" > <tr:commandButton id="saveButton" text="Save" > actionListener="#{controllerBean.save}" > > > Thanks for your help, > Tom > -- > View this message in context: > http://old.nabble.com/MyFaces-Trinidad-1.2---set-method-wont-be-called-after-changing-textfield-from-disabled%3Dtrue-to-disabled%3Dfalse-%28PPR%29-tp32327168p32327168.html > Sent from the MyFaces - Users mailing list archive at Nabble.com. >

