You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/01/21 10:13:59 UTC

svn commit: r1725894 - /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/upload.xhtml

Author: lofwyr
Date: Thu Jan 21 09:13:59 2016
New Revision: 1725894

URL: http://svn.apache.org/viewvc?rev=1725894&view=rev
Log:
upload with validation

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/upload.xhtml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/upload.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/upload.xhtml?rev=1725894&r1=1725893&r2=1725894&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/upload.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/upload.xhtml Thu Jan 21 09:13:59 2016
@@ -25,7 +25,7 @@
   <ui:param name="title" value="File Upload"/>
   <tc:panel>
     <f:facet name="layout">
-      <tc:gridLayout rows="auto;*"/>
+      <tc:gridLayout rows="auto;auto;*"/>
     </f:facet>
 
     <tc:panel>
@@ -33,14 +33,22 @@
         <tc:gridLayout columns="*;auto"/>
       </f:facet>
 
-      <tx:file label="Upload file:" value="#{upload.file}">
-        <!-- todo: write a 2nd example to demonstrate validation
-              <tc:validateFileItem contentType="image/gif image/png"/>
-        -->
-      </tx:file>
+      <tx:file label="Upload file:" value="#{upload.file}" tip="without extra validation"/>
       <tc:button label="Submit" defaultCommand="true" action="#{upload.upload}"/>
     </tc:panel>
 
+    <tc:panel>
+      <f:facet name="layout">
+        <tc:gridLayout columns="*;auto"/>
+      </f:facet>
+
+      <tx:file label="Upload image:" value="#{upload.file}"
+               tip="with a validator for file items - types: gif, jpg, png">
+        <tc:validateFileItem contentType="image/*"/>
+      </tx:file>
+      <tc:button label="Submit" action="#{upload.upload}"/>
+    </tc:panel>
+
     <tc:sheet var="entry" value="#{upload.list}" columns="*;*;*">
 
       <tc:column label="Name">