In case this replay didn't end up in the appropriate thread:

http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/
db829a1d3ca58d79

 

REPLY:

 

So here is my simple test using your method:

 

I had to change the 'onSuccess' method in the updater to 'onComplete'

it wasn't working for some reason. I don't remember if 'onSuccess' is

after the DOM is loaded or not.

 

<html>

   <head>

       <title>Simple callback test</title>

       <script type="text/javascript"
src="/js/protoaculous.1.8.2.min.js"></script>

       <script type="text/javascript">

           function userChooser(callback) {

               $('readout').insert({ bottom: 'loading callback.vb.asp...<br
/>' });

               new Ajax.Updater('divID', 'callback.vb.asp', {

                   onComplete: function() {

                       updateSuccess();

                       $('readout').insert({ bottom: 'loading success!<br
/>' });

                   }

               });

 

               function updateSuccess() {

                   $('divID').down("input[name=btnChoose]").observe('click',
chosenClick);

                   $('readout').insert({ bottom: 'observing button...<br />'
});

               }

 

               function chosenClick(event) {

                   var theDiv;

                   event.stop();

                   $('readout').insert({ bottom: 'event stopped...<br />'
});

                   theDiv = $('divID');

                   theDiv.stopObserving('click', chosenClick);

                   $('readout').insert({ bottom: 'observing stopped...<br
/>' });

                callback(theDiv.down('select[name=choices]').getValue());

               }

           }

           Event.observe(window, 'load', function() {

               userChooser(choiceMade);

               function choiceMade(choice) {

                   $('readout').insert({ bottom: choice + '<br />' });

               }

           });

       </script>

       <style type="text/css">

           body{margin:0px;padding:0px;}

           #divID{border:solid 1px #000;width:400px;}

           #readout{font:normal 8pt Arial;width:400px;}

       </style>

   </head>

   <body>

       <div id="divID"></div>

       <div id="readout"></div>

   </body>

</html>

 

 

and callback.vb.asp:

 

<select name="choices">

   <option value="1">Bob</option>

   <option value="2">Dave</option>

   <option value="3">Joe</option>

   <option value="4">Mick</option>

</select><br />

<input type="button" name="btnChoose" value="Choose User" />

 

 

It works perfectly. As long as I disable any other user input until

they have chosen a user, this should work out great.

 

Again sorry for the long wait for my response. Your work is much

appreciated!

 

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to