[jboss-user] [JBoss Seam] - Adding attributes to s:fileUpload

davidfed do-not-reply at jboss.com
Tue Jun 26 22:50:13 EDT 2007


-- Seam 1.2.1 standard setup --

I needed to add onclick, onfocus and onblur events to my s:fileUpload tags but the attributes weren't showing up in the html.  So I added them to UIFileUpload.java.  Is this the correct way to do this?


  | Index: UIFileUpload.java
  | 
  | ===================================================================
  | 
  | --- UIFileUpload.java	(revision 5)
  | 
  | +++ UIFileUpload.java	(working copy)
  | 
  | @@ -25,7 +25,10 @@
  | 
  |        
  |     private String accept;
  |     private String styleClass;
  | -   private String style;   
  | +   private String style;  
  | +   private String onclick;
  | +   private String onfocus;
  | +   private String onblur;
  |     
  |     @Override
  |     public void decode(FacesContext context)
  | @@ -151,7 +154,22 @@
  | 
  |        {
  |           writer.writeAttribute(HTML.STYLE_ATTR, style,  null);
  |        }
  | -      
  | +          
  | +      if (onclick != null)
  | +      {
  | +         writer.writeAttribute(HTML.ONCLICK_ATTR, onclick,  null);
  | +      }
  | +          
  | +      if (onfocus != null)
  | +      {
  | +         writer.writeAttribute(HTML.ONFOCUS_ATTR, onfocus,  null);
  | +      }
  | +          
  | +      if (onblur != null)
  | +      {
  | +         writer.writeAttribute(HTML.ONBLUR_ATTR, onblur,  null);
  | +      }
  | +          
  |        writer.endElement(HTML.INPUT_ELEM);
  |     }
  |     
  | @@ -191,4 +209,34 @@
  | 
  |        this.styleClass = styleClass;
  |     }
  |  
  | +   public String getOnblur()
  | +   {
  | +      return onblur;
  | +   }
  | +
  | +   public void setOnblur(String onblur)
  | +   {
  | +      this.onblur = onblur;
  | +   }
  | +
  | +   public String getOnclick()
  | +   {
  | +      return onfocus;
  | +   }
  | +
  | +   public void setOnclick(String onclick)
  | +   {
  | +      this.onclick = onclick;
  | +   }
  | +
  | +   public String getOnfocus()
  | +   {
  | +      return onfocus;
  | +   }
  | +
  | +   public void setOnfocus(String onfocus)
  | +   {
  | +      this.onfocus = onfocus;
  | +   }
  | +
  |  }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4057936#4057936

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4057936



More information about the jboss-user mailing list