How to use status for non-ajax controls in 3.3.x

Version 1

    to show status from non-ajax controls we could use just js.

     

    Next points should be considered:

    • status outside regions always has _viewRoot:status id (just 3.3.x issue which will be addressed in 4.x)
    • status inside regions(with any nesting) has <parentRegionId>:status id (the same)
    • statuses facets has next id's : <statusId>.start and <statusId>.stop

     

    So just show start facet and hide stop facet manually from h:command*. Status will be there and after page refresh - it will be switched to stop state by itself because of reinitializing..

     

    example:

     

    <a4j:status id="commonstatus"  startText="In progress..." stopText="Complete"/>
    <br />
    <rich:spacer height="5" />
    <a4j:region id="r1">
    <a4j:region id="r2">
    <script>
    function switchStatus(){
    document.getElementById('_viewRoot:status.start').style.display='inline';
    document.getElementById('_viewRoot:status.stop').style.display='none';
    }
    </script>
    <h:form>
    <h:commandButton eventsQueue="foo"  value="Ajax Request" onclick="switchStatus();"/>
    </h:form>
     <a4j:status id="commonstatus"  startText="In progress..." stopText="Complete"/>
    
     <script>
     function switchStatus(){
     document.getElementById('_viewRoot:status.start').style.display='inline';
     document.getElementById('_viewRoot:status.stop').style.display='none';
     }
     </script>
     <h:form>
       <h:commandButton value="Common Request with status" onclick="switchStatus();"/>
     </h:form> 
    

     

     

    This document was generated from the following discussion: PDF generation using HttpServletResponse and AJAX status