0

I want to press a button and the action should be fired and the button deactivated with a small text message (in progress...). The action upload a file and redirect to other page to show its contents.

In my code, either the action will be immediately executed (onstart) and redirect to other page without deactivate the button and showing the message or if i set the redirection functionality as action and onstart deactivate the button and show the message, then the redirection functionality doesn't work.

I tried many things including settimeout but it doesn't help me.

<h:form enctype="multipart/form-data">
            Excel File <h:inputFile value="#{uploadManagedBean.part}"></h:inputFile>
        <br></br>
        <h:commandButton value="Upload" 
            action="#{uploadManagedBean.messageByUploadClick()}"
            onclick="setTimeout({'#{uploadManagedBean.redirectToTable()};'}, 5000)"
            disabled="#{uploadManagedBean.buttonStatus}">
            <f:actionListener binding="#{uploadManagedBean.buttonStatusChange()}"></f:actionListener>
        </h:commandButton>
        <h:outputText value="#{uploadManagedBean.messageTextUpload}" />
    </h:form>
Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
Jack
  • 3
  • 3

0 Answers0