jsf - Pass value of another input component when uploading file via p:fileUpload mode=advanced -
i have add primefaces fileupload.
<h:form id="form" enctype="multipart/form-data"> <h:selectonemenu id="collection" value="#{imputdata.colllist.currentcoll}"> <f:selectitems value="#{imputdata.colllist.colllist}" /> </h:selectonemenu> <p:fileupload id="fileupload" label="durchsuchen" uploadlabel="upload" cancellabel="zurück" fileuploadlistener="#{imputdata.handlefileupload}" mode="advanced" dragdropsupport="true" update="collection,messages" sizelimit="100000" allowtypes="/(\.|\/)(txt|cvs)$/" /> <p:growl id="messages" showdetail="true"/> <h:commandbutton id="read" action="#{imputdata.imput}" value="#{msgs.read}"/> </h:form>
it looks
i have 2 question. how can made fileupload smaller. mean not wide on hole page?
to name selectonemenu must klick on read-button (lesen). if klick und upload-button no information selectonemenu (null). must write ajax="true" in <p:fileupload..
or information selectonemenu in upload-button?
i write id collection in update of fileupload update="collection,messages"
doesn't slove problem.
you can use onstart
of fileupload, call remotecommand process selectonemenu , save property of same bean must view scoped.
<p:fileupload id="fileupload" mode="advanced" onstart="submitcollection()" /> <p:remotecommand name="submitcollection" process="@this collection" />
as width of fileupload, can use following css:
.ui-fileupload { width: 400px;//change px fits }
hope helps.
Comments
Post a Comment