Thanks Kevin and Malcom for responding.

Kevin is right in that I don't need AJAX.  I came up with a different
method that also allows me to change the string above my progress bar to
reflect what I'm actually doing at the moment.

My method (roughly) involves setting the HTTPResponse content to an
iterator and having the iterator split a rendered template.  It yields
the first part which would load the progress bar and display it.  Then
it calls a passed in callback function to do the actual processing, then
yield the last part of the rendered template which would turn the
progress bar off.  If anybody is interested, I can post code and go
through exactly what I do.

Another thing I tried for fun was passing in a reference to a Python
function to the template.  Had the template call a tag I made myself
which then calls the passed in Python function.  Turns out, you can do
that but the display wasn't updated properly.

On Wed, 2009-02-18 at 16:12 -0800, Kevin Audleman wrote:
> Ajax would only be necessary if you want a status bar that reflects
> accurately the progress. You can probably get by with something
> simpler. I would write some Javascript that is triggered on clicking
> the submit button that replaces the button with this graphic:
> http://yesmagazine.org/store/images/pleasewait.gif
> 
> 
> Your Javascript looks like this:
> 
> ?>
> <script language="javascript" type="text/javascript"><!--
> 
> 
> function SubmitOrderButton(){
>         document.getElementById("submitmain").style.display = "none";
> 
>       if (navigator.appName == "Microsoft Internet Explorer") {
>       document.getElementById("pleasewait").innerHTML = "";
>       document.getElementById("pleasewait").style.display = "block";
>       document.getElementById("pleasewait").innerHTML = "<img src='images/
> pleasewait.gif' alt='Please Wait'>";
>       } else {
>       document.getElementById("pleasewait").style.display = "block";
>       }
> }
> 
> //--></script>
> 
> And your HTML code looks like this:
> 
> <div id="submitmain" class="buttonRow forward">
>       <input type="submit" name="btn_submit" value="Confirm Order"
> class="checkout_button"  />
> </div>
> <div id="pleasewait" class="buttonRow forward" style="display:none">
>       <img src="/images/pleasewait.gif"><br />
>        Please wait while your request is being processed...
> </div>
> 
> Cheers,
> Kevin Audleman
> 
> On Feb 18, 2:52 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
> wrote:
> > On Wed, 2009-02-18 at 12:20 +0000, Adam Stein wrote:
> > > Maybe somebody can suggest how to get the functionality I'm trying to
> > > duplicate.  I looked and can't find anything that seemed similiar.
> >
> > > I have a form with checkboxes.  User selects one or more and submits the
> > > form.  The processing currently goes like this:
> >
> > > 1) Write JavaScript to display moving progress bar
> > > 2) Process based on checked boxes (which in my specific example is to
> > > copy the specified databases into a sandbox area)
> > > 3) Write JavaScript to turn off progress bar
> >
> > > The database copying is short, up to about 20 seconds.  Short enough to
> > > let the user wait, long enough that I want to indicate the computer
> > > hasn't frozen :-{}
> >
> > > It seems that I can only return HTML to be displayed once from a view.
> > > Is there a way to get the functionality described above somehow?
> >
> > It's called AJAX. You have to keep asking the server for an update and
> > then updating the page.
> >
> > Regards,
> > Malcolm
> -- 
Adam Stein @ Xerox Corporation       Email: a...@eng.mc.xerox.com

Disclaimer: Any/All views expressed
here have been proven to be my own.  [http://www.csh.rit.edu/~adam/]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to