Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is it possible to force a flush or refresh?

    Hi, Am fetching some elements dynamically from server, and since this could take a few moments, wanted to include a "... loading..." message in a span so the user knows to hold on.

    Change the visibility of the span class, and then run the function to get the elements. However the javascript runs the code but then goes straight into the database function .. without first affecting the visibility of the span.

    Is there some way I can force the script to refresh itself? Some kind of flush etc so can see the change on the page. If I place an alert after the class change, then it works fine, but the moment I take the alert out it seems to run into the database reteival function and forget to make the class change.

    document.getElementById('StateLabel').className = 'Show';

    FetchStates('MaintainProfile.GetStates', 'stateDisplay', countryId);

    document.getElementById('StateLabel').className = 'Hide';

    Thanks

    Mickey

  • #2
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is this what you mean...
    Code:
    document.getElementById('StateLabel').style.visibility = 'visible';
    
    FetchStates('MaintainProfile.GetStates', 'stateDisplay', countryId);
    
    document.getElementById('StateLabel').style.visibility = 'hidden';

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Try this:

    Code:
    setTimeout(function(){
      document.getElementById('StateLabel').className = 'Show';
      }, 10);
    
    FetchStates('MaintainProfile.GetStates', 'stateDisplay', countryId);
    document.getElementById('StateLabel').className = 'Hide';
    You have to delay the showing of the label a bit. If that doesn't work, try delaying the hiding of the label too.

  • #4
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Glen for your help. Mickey


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •