One way to do this is to include some javascript in the result HTML
that calls a function to re-enable the buttons.

like:

<script type="text/javascript">resetButtons()</script> ...then just
build your resetButtons() function to do the work.

To make sure this is executed when you Ajax call finishes, you need to
add the option "evalScripts:true" in your Ajax call.

On May 30, 10:03 am, lhotch <[EMAIL PROTECTED]> wrote:
> For starters, im a total novice when it comes to javascript so please
> bearwith me.
>
> What I have i a web page that makes use of PHP and the
> Ajax.PeriodicalUpdater to launch an external PHP script and unpdate
> the source web page.
>
> This is working wonderfully for the most part. However I wanted to add
> some functionality to the page. With that in mind I wanted to give the
> user the ability to run some external commands at the press of a
> button so to handle this I used Ajax.Updater and this also works fine
> in terms of starting the external processes I need started.
>
> In an affort to prevent multipl instances of the external commands to
> be started, I disable the buttons after they are pressed but I would
> like them to be reenabled automatically when the process that they
> started completes so the process can be run again.
>
> Ive tried using the onComplete and onSuccess options to re-enable the
> buttons but it doesnt seem to be working for me. Since I am new to JS
> I think its likely because I am not using them properly but the
> documentation is a bit dificult for me as a newbie to grasp.
>
> I have a function defined in the head of the document and I call that
> function to disable the buttons onClick, which it does. I was hoping
> however that when the Ajax.Updater was done I could use onComplete or
> onSuccess to call the function to enable the buttons but cant seem to
> get it to work.
>
> Ideally what I would like to do is I have  php script called by
> Ajax.PeriodicalUpdater set a php session variable. As this script
> monitors the actions started by the buttons the session variable is
> continually updated and what I would like to do is have onComplete or
> onSuccess re-enable the buttons when the session variable is a certain
> value.
>
> Can someone be so kind as to better explaine, in simple terms how I
> could accomplish this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to