I have the requirement that I have to pass the value of inputText to backing bean which will contain the version of the file along with the file upload. I have been trying to achieve it using remote command but not working.
Below is my code:
<h:form enctype="multipart/form-data" id="uploadForm">
<p:growl id="messages" showDetail="true" />
<p:outputLabel for="vers" value="File Version:" />
<p:inputText id="vers" name="vers"
value="#{remoteDeployment.uploadedVersion}" placeholder="1.x.x.x"
maxlength="17" required="true"
requiredMessage="Version is required." />
<p:separator />
<p:fileUpload onstart="submitVersion()"
fileUploadListener="#{remoteDeployment.upload}" update="messages" >
<f:attribute name="terminalSettings" value="#{as}" />
</p:fileUpload>
<p:remoteCommand name="submitVersion" process="@this vers" />
</h:form>
String in backing bean for input text :
@ViewScoped
private String uploadedVersion;
public String getUploadedVersion() {
return uploadedVersion;
}
public void setUploadedVersion(String uploadedVersion) {
this.uploade
please help and also let me know if there is any other way of doing it.
Thanks
This worked for me.
<h:form enctype="multipart/form-data" id="uploadForm">
<p:growl id="messages" showDetail="true"/>
<p:outputLabel for="vers" value="File Version:"/>
<p:inputText id="vers" name="vers"
value="#{remoteDeployment.uploadedVersion}" placeholder="1.x.x.x"
maxlength="17" required="true"
requiredMessage="Version is required."/>
<p:separator/>
<p:fileUpload fileUploadListener="#{remoteDeployment.upload}" update="messages">
<f:attribute name="terminalSettings" value="#{as}" oncomplete="$('#uploadForm').submit()"/>
</p:fileUpload>
</h:form>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With