myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "R. Müller" <r.muel...@unicomp-berlin.de>
Subject Re: editable forms
Date Tue, 06 Dec 2005 08:52:11 GMT
Thank you.

I think i will try a similiar approach.

Regards Ronald

Yee CN wrote:
> What I did is that I maintain an enum called screenMode={VIEW,EDIT,ADDNEW}
> in the backing bean. 
> 
> 	public boolean isEditMode() {
> 		return this.screenMode == ScreenMode.EDIT || this.screenMode
> == ScreenMode.ADDNEW;
> 	}
> 	
> 	public boolean isAddnewMode() {
> 		return this.screenMode == ScreenMode.ADDNEW;
> 		//return this.addNew;
> 	}
> 
> 	/**
> 	 * Getting/Setting the ScreenMode Enum as String
> 	 * @return String
> 	 */
> 	public String getScreenMode() {
> 		return this.screenMode.toString() ;
> 	}
> 	
> 	public void setScreenMode(String mode) {
> 		this.screenMode = ScreenMode.valueOf(mode) ;
> 	}
> 
> 
> In your jsf file you will do:
> <t:saveState value=”#{myBean.screenMode}” />
> <h:selectOneMenu rendered="#{!myBean.editMode}"
> 
> 
> Hope this help.
> 
> Regards,
> Yee
> 
> -----Original Message-----
> From: "R. Müller" [mailto:r.mueller@unicomp-berlin.de] 
> Sent: Monday, 5 December 2005 11:06 PM
> To: users@myfaces.apache.org
> Subject: editable forms
> 
> hi group,
> 
> in a particular form i want the fields only editable, if there is 
> explicitly set a edit-param.
> 
> I've tried it with the following code :
> 
> <h:outputText    rendered="#{empty param.edit}"
> 
> value="#{backingBean.value}/>
> <h:selectOneMenu rendered="#{!empty param.edit}"
> 
> value="#{backingBean.value}">
> 	<f:selectItems value="#{selectItems}" />
> </h:selectOneMenu>
> 
> But i've noticed that when submitting the form the 'setter'-method of 
> the 'backingBean.value' is never called.
> Leaving out the 'rendering'-attribute, which means that the component is 
> always editable everthing works fine.
> I've got the same behaviour when using the 'disabled'-attribute.
> 
> Does anybody has an explanation for this or hints how to solve this in a 
> 'clean way' ?
> 
> thanx
> 
> 
> ronald

-- 
*********************************************************
*M-Unicomp GmbH
*
*Ronald Müller
*
*Plauener Straße 163-165, Haus 11
*13053 Berlin
*
*fon   : +49 ( 0 ) 30  / 98 69 61 54
*mobil : +49 ( 0 ) 172 / 93 95 00 4
*fax   : +49 ( 0 ) 30  / 98 69 61 55
*email : r.mueller@unicomp-berlin.de
*web   : www.unicomp-berlin.de
********************************************************

Mime
View raw message