Can't figure out exactly how to use this...I am just using Ajax/ Javascript...not really a Javascript programmer...
That's why some examples may help... Thanks. On Sep 27, 3:11 pm, "Brian Williams" <[EMAIL PROTECTED]> wrote: > or have your first "login" ajax request return code to call another function > containing an Ajax.Updater with the other div's ID > > yeah, it's kind of ugly, but effective none-the-less. > > On 9/27/07, Alex Duffield <[EMAIL PROTECTED]> wrote: > > > > > > > ajax.updater will update what ever id you provide. > > If you want to do something more complex than just update one id after the > > ajax is complete, you should use ajax.request, and then set a function to > > be called on complete. > > > More on Ajax.Request here > > >http://www.prototypejs.org/api/ajax/request > > > On 27-Sep-07, at 1:59 PM, Mircea wrote: > > > I know how to use Prototype for submitting a form and get the result > > in the same DIV where the form was. > > > The only problem is that after getting the results of the submitted > > form I want to update another DIV with the new results. > > > Say I have the form (in a DIV) and under the form is a table (in > > another DIV) with several results. > > If I add a record using the form then I want to show the succes > > message and that table to be updated with the new result I just added > > (without reloading the whole page). > > > All using AJAX from Prototype. > > > Seem simple at a glance...but I couldn't find out how to implement > > it... > > > For the form I am using this: > > --------- > > onsubmit="new Ajax.Updater('DIV_1, '/forms/dsp_add_edit.cfm? > > view=0&stage=add&action=update&id_cat=1', {asynchronous:true, > > parameters:Form.serialize(this)}); return false;" > > -------- > > > The success message is hard-coded in the HTML file which is returned > > after posting the data. It's not returned using Prototype. > > > The Loading message is displayed with the help oif this code: > > -------- > > <!--- show/hide the Loading... ---> > > <script language="JavaScript" type="text/javascript"> > > <!-- > > // --- show/hide loading --- > > var myGlobalHandlers = { > > onCreate: function(){ > > > toY = getPageScroll() + 220; > > Element.setStyle('systemWorking',{top: toY+'px', left: '580px'}); > > Element.show('systemWorking'); > > }, > > > onComplete: function() { > > if(Ajax.activeRequestCount == 0){ > > Element.hide('systemWorking'); > > } > > } > > }; > > Ajax.Responders.register(myGlobalHandlers); > > > function getPageScroll(){ > > var yScroll; > > if (self.pageYOffset) { > > yScroll = self.pageYOffset; > > } else if (document.documentElement && > > document.documentElement.scrollTop){ // Explorer 6 Strict > > yScroll = document.documentElement.scrollTop; > > } else if (document.body) {// all other Explorers > > yScroll = document.body.scrollTop; > > } > > return yScroll; > > } > > > //--> > > </script> > > ------------- > > 'systemWorking' is the DIV which shows the Loading message...abd the > > function getPageScroll show me the Loading message regardless how I > > scroll the page (I can take this out if I want). > > > Mircea > > > On Sep 27, 10:21 am, Transistor <[EMAIL PROTECTED]> wrote: > > > I'm working on something like this. > > So far, it consists of 6 functions to process the form and act > > according to the results. > > I have a general function that validates and sends all the fields to > > be processed on the server (I use PHP). > > I use another three very fine libraries: script.aculo.us, the > > Prototype Window class and Dexgogo field Validation. > > [code] > > function submitValues(form,url,msg) { > > var valid = new Validation(form); > > > ______________________________________________________________________ > > *Alex Duffield* *â -* *Principal* *â -* *InControl Solutions* *.* * > >http://www.incontrolsolutions.com*<http://www.incontrolsolutions.com/>- Hide > >quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---