You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Chiappone <ch...@gmail.com> on 2006/02/10 18:02:14 UTC

How to get a property from a table wrapped in a form component

I have a contrib table that is wrapped in a form.  The form has a
column that contains three checkboxes.  I can't seem to figure out how
to get the correct value of the checkbox when the form is submitted. 
I am only getting the last value in the list.

Here is my page code:
        /** Form submit listener **/
	public IPage changePermissions(){
		
		log.info("INSIDE CHANGE PERMISSION FORM SUBMISSION");
		
		
		
		CasePage cp = (CasePage) getPage();
		if(cp.getDocList() != null){
			
			for(Document doc : cp.getDocList()){
				
				if(doc != null){
					String perm = getPermission();
					
					
					log.info("Current Permission for "+ doc.getTitle() + " "+ perm);
				}
			}
			
		}
		
		return null;
	}


	private String getPermission(){
		if(isMerchantView() && isSponsorView() && isAssocView()){
			return "e";
		}else if(isMerchantView() && isSponsorView()){
			return "ms";
		}else if(isMerchantView() && isAssocView()){
			return "ma";
		}else if(isSponsorView() && isAssocView()){
			return "sa";
		}else if(isMerchantView()){
			return "m";
		}else if(isSponsorView()){
			return "s";
		}else if(isAssocView()){
			return "a";
		}else{
			return "";
		}
	}


	public boolean isSponsorView(){
		if(getPage().getRequestCycle().isRewinding()){
			log.info("Page is rewinding....");
			return this.sponsorView;
		}else{
			return PermissionViewer.isSponsorViewable(getDocFromTable());
		}
		
	}
	
	public void setSponsorView(boolean s){
//		log.info("Setting SPONSORVIEW");
		this.sponsorView = s;
	}
	
	public boolean isMerchantView(){
		if(getPage().getRequestCycle().isRewinding()){
			log.info("Page is rewinding....");
			return this.merchantView;
		}else{
			return PermissionViewer.isMerchantViewable(getDocFromTable());
		}
		
	}
	
	public void setMerchantView(boolean m){
//		log.info("Setting SPONSORVIEW");
		this.merchantView = m;
	}
	
	public boolean isAssocView(){
		if(getPage().getRequestCycle().isRewinding()){
			log.info("Page is rewinding....");
			return this.assocView;
		}else{
			return PermissionViewer.isAssociationViewable(getDocFromTable());
		}
		
	}
	
	public void setAssocView(boolean a){
//		log.info("Setting SPONSORVIEW");
		this.assocView = a;
	}

--
~chris

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org