-
1. Re: progressBar on client
dgreenbean Sep 18, 2008 4:10 PM (in response to dgreenbean)Apparently I posted too soon, but it still doesn't work as I would expect.
The following works:<a4j:form> <rich:progressBar id="myProgress" mode="client" /> <script> // <![CDATA[ function startMyProgress() { #{rich:component('myProgress')}.setValue(100); } function stopMyProgress() { #{rich:component('myProgress')}.setValue(101); } // ]]> </script> </a4j:form> <a4j:form ajaxSubmit="true"> <a4j:commandButton value="click me to start" onclick="startMyProgress();" /> <a4j:commandButton value="click me to stop" onclick="stopMyProgress();" /> </a4j:form>
The following does not:<a4j:form> <rich:progressBar id="myProgress" mode="client" /> <script> // <![CDATA[ function startMyProgress() { #{rich:component('myProgress')}.setValue(100); } function stopMyProgress() { #{rich:component('myProgress')}.setValue(101); } // ]]> </script> </a4j:form> <a4j:form ajaxSubmit="true" onsubmit="startMyProgress();" oncomplete="stopMyProgress();"> <a4j:commandButton value="click me" /> </a4j:form>
It seems that the problem here is the oncomplete code is never run. Does anyone know why this might be? -
2. Re: progressBar on client
andrei_exadel Sep 19, 2008 4:16 AM (in response to dgreenbean)Move 'oncomplete' attribute from the <a4j:from> component to <a4j:support>:
<a4j:form ajaxSubmit="true" onsubmit="startMyProgress();"> <a4j:commandButton value="click me" oncomplete="stopMyProgress();"/> </a4j:form>
-
3. Re: progressBar on client
andrew_st Mar 10, 2009 11:40 AM (in response to dgreenbean)Hello,
a lot of time has passed but let me still post the question - why it is needed to place progressBar and js-functions AND commandButton in two different forms? -
4. Re: progressBar on client
ilya_shaikovsky Mar 10, 2009 11:50 AM (in response to dgreenbean)the first form not needed at all because PB component used as client side in this sample.
-
5. Re: progressBar on client
dgreenbean Mar 10, 2009 12:45 PM (in response to dgreenbean)The first form is not needed. My general use case is to have one form for the input parameters and one for the results, which is where the progress bar would be located. Re-rendering the results form on complete also works.
What would be really, really neat would be for the following to be possible:<rich:progressBar id="myProgress"> <f:facet name="initial"> <h:outputText value="initial block" /> </f:facet> <f:facet name="complete"> <h:outputText value="Success!!!" /> </f:facet> </rich:progressBar> <a4j:form> <a4j:commandButton value="Submit" progress="myProgress" /> </a4j:form>
The idea behind this is that I rarely care to display a percentage for the progress, but I almost always want to display a progress bar when someone searches for information. The visual feedback provided by the bar when a user hits a button is very important to show the user that something is happening.
Currently, I wrap some of this in a facelets component, but it can get a little messy with all the JavaScript that gets embedded in the page. I often have 10-20 such progress bars on a page. Any ideas on how to do this cleanly are appreciated.
Thank you,
David -
6. Re: progressBar on client
nbelaevski Mar 10, 2009 2:32 PM (in response to dgreenbean)Hi David,
Why not use a4j:status? -
7. Re: progressBar on client
dgreenbean Mar 10, 2009 2:44 PM (in response to dgreenbean)I had not seen that component before, but it looks like it is exactly what I want. I guess sometimes the answer is staring you right in the face. Thanks for the suggestion!