ttakci
ttakci

Reputation: 77

how can i use two uploadFile components?

i have a tabview with 2 tabs. And i wanna use two uploadFile components for each tab. I use 'advanced' mode for uploadFile component. When i try to upload invalid file (there can be invalid file size error or invalid file type error) for the first tab uploadFile component, the error message is shown for both tabs uploadFile components. I use PF 3.4.1. In pf_user_guide_3.4, "Multiple advanced uploaders in same form is not supported at the moment" is written. Is my issue related to this note? Is there anyone has an idea about this situation?

    main.xhtml
    ..........
    <h:form id="formTabView">
       <p:tabView id="tvSample" activeIndex="#{sampleBean.selectedTab}" cache="false">         
         <p:tab id="tabSubMerchants" title="#{messagebundle.submerc_tab_submerch}">
            <ui:include src="tabsubmerchantssubmtab.xhtml" />
         </p:tab>
        <p:tab id="tabServices" title="#{messagebundle.submerc_tab_svc}">
            <ui:include src="tabsubmerchantssevicestab.xhtml" />
        </p:tab>
      </p:tabView>
    </h:form>
    ...........

    tabsubmerchantssubmtab.xhtml
    ...........
    <h:form id="formTab1Files">
       <p:fileUpload id="fuSubMerchant"
         fileUploadListener="#{fileOperations.uploadSubMerchantFile}"
         sizeLimit="2097152" multiple="true"
         allowTypes="/(\.|\/)(gif|jpeg|png|txt|pdf|doc|docx)$/"
         label="#{messagebundle.fileupload_upload}" auto="true"              
         invalidFileMessage="#{messagebundle.submerc_error_011}"
         invalidSizeMessage="#{messagebundle.submerc_error_012}">
       </p:fileUpload>
    </h:form>      
    ..............



     tabsubmerchantssevicestab.xhtml
     ...................
     <h:form id="formSvcFiles">
        <p:fileUpload id="fuService" 
           fileUploadListener="#{fileOperations.uploadServiceFile}"
           sizeLimit="2097152" multiple="true"
           allowTypes="/(\.|\/)(gif|jpeg|png|txt|pdf|doc|docx)$/"
           label="#{messagebundle.fileupload_upload}" auto="true"
           invalidFileMessage="#{messagebundle.submerc_error_011}"
           invalidSizeMessage="#{messagebundle.submerc_error_012}">
        </p:fileUpload>
     </h:form>         

.....................

Upvotes: 3

Views: 182

Answers (1)

partlov
partlov

Reputation: 14277

You have one form, inside which are two more forms. I think you should remove parent form, and leave just forms inside tabs.

Upvotes: 1

Related Questions