Hi Folks! I''m new in the forum and i have a doubt. The button back function with the Ajax on Rails? tks. -- Posted via http://www.ruby-forum.com/.
Your question is a *little* vague but I''ll assume I understand it. Any AJAX stuff you do essentially "breaks" the back button in the sense that the browser doesn''t "know" about the incremental page changes taking place via AJAX. So if you go from Page A to Page B and then update three HTML elements on Page B and hit the Back button in the browser, you''re back at Page A (and presumably all your changes to Page B are gone). That''s one of the main criticisms of using AJAX; it breaks the basic navigational paradigm. It''s not *hard* to design your Web apps so that this doesn''t become an issue (always open your AJAX pages in a new window and confine your AJAX apps -- or logical segments thereof -- to single pages), but it does require some additional thinking. HTH, On Jan 11, 2006, at 8:14 PM, Junior Mar?al wrote:> Hi Folks! I''m new in the forum and i have a doubt. The button back > function with the Ajax on Rails? tks. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -.-.-.-.-.-.-.-.-.-.-.-.-.-.- Dan Shafer Technology Visionary - Technology Assessment - Documentation "Looking at technology from every angle" http://www.eclecticity.com
Junior Mar?al wrote:> Hi Folks! I''m new in the forum and i have a doubt. The button back > function with the Ajax on Rails? tks.A properly designed page should not use AJAX in such a way that the back button is broken. If you have two pages which logically should be referenced via different URLs, i.e., they''re actually difference resources, then you shouldn''t be transferring from one to the other with AJAX. AJAX should only be used to edit in-page items. For example, if you have a form which sends mail then a sensible use of AJAX would be to send the email asynchronously and change the input forms to a success message when complete. Another example would be in-place editing of lists, say, of bookmarks. -- Jesse Farmer <farmerje@uchicago.edu> University of Chicago - NSIT Web Services AIM: farmerje Jabber: farmerje@im.uchicago.edu Phone: (773)363-1058
Junior Mar?al <jcalled@...> writes:> > Hi Folks! I''m new in the forum and i have a doubt. The button back > function with the Ajax on Rails? tks.There are way to preserve state across page views so that browser history (back and forward buttons) and bookmarking works in javascript/AJAX applications. Some AJAX frameworks, such as the DOJO toolkit, include a history mechanism. The javascript libraries that ship with Rails (prototype and script.aculo.us) do not, so you''ll have to write one yourself. Read this blog post if you want to learn more about how to do it: http://codinginparadise.org/weblog/2005/08/ajax-tutorial-saving-session-across.html I''ve had a mixed experience implementing the approach detailed in that blog post. Everything works great out of the box in Firefox (and Safari IIRC), but IE was a nightmare. IE doesn''t repopulate form values (the basis of the history mechanism in the post above) unless you''ve got your cache HTTP headers (cache-control and IE-specific ETag) set in the response. But caching doesn''t work well if the page in question has dynamic content. IE also refused to repopulate form values in iframes even with the cache control header set making it impossible to separate dynamic content from the content that requires the history mechanism. Tyler
On Thursday 12 January 2006 12:44 am, Jesse Farmer wrote:> Junior Mar?al wrote: > > Hi Folks! I''m new in the forum and i have a doubt. The button back > > function with the Ajax on Rails? tks. > > A properly designed page should not use AJAX in such a way that the back > button is broken. If you have two pages which logically should be > referenced via different URLs, i.e., they''re actually difference > resources, then you shouldn''t be transferring from one to the other with > AJAX. > > AJAX should only be used to edit in-page items. For example, if you > have a form which sends mail then a sensible use of AJAX would be to > send the email asynchronously and change the input forms to a success > message when complete. Another example would be in-place editing of > lists, say, of bookmarks.How bout field level validation? SteveT Steve Litt Author: * Universal Troubleshooting Process courseware * Troubleshooting Techniques of the Successful Technologist * Rapid Learning: Secret Weapon of the Successful Technologist Webmaster * Troubleshooters.Com * http://www.troubleshooters.com
Steve Litt wrote:> How bout field level validation? >As long as you don''t absolutely rely on it, I can''t see any reason not to use it... -- Alex
Steve Litt wrote:> On Thursday 12 January 2006 12:44 am, Jesse Farmer wrote: >> Junior Mar?al wrote: >>> Hi Folks! I''m new in the forum and i have a doubt. The button back >>> function with the Ajax on Rails? tks. >> A properly designed page should not use AJAX in such a way that the back >> button is broken. If you have two pages which logically should be >> referenced via different URLs, i.e., they''re actually difference >> resources, then you shouldn''t be transferring from one to the other with >> AJAX. >> >> AJAX should only be used to edit in-page items. For example, if you >> have a form which sends mail then a sensible use of AJAX would be to >> send the email asynchronously and change the input forms to a success >> message when complete. Another example would be in-place editing of >> lists, say, of bookmarks. > > How bout field level validation?Sure, why not? You have some form to create, say, a listing which submits the data asynchronously to ListingController''s create method. Any errors can be fetched asynchronously, and on success you can delete all the form elements and display a "success" message. The create method could re-render the form entirely so you get the fancy CSS stuff Rails does, and you just blank the old form and replace it with the asynchronously fetched form. I actually think AJAX can be used to unbreak the back button. Many times you''re in a state where going back takes you to stale data. This can be dangerous in the case of submitting a form where there is the potential for submitting the data twice, either by going back from the "success" page or by hitting refresh on the "success" page, thereby POSTing all over again. -- Jesse Farmer <farmerje@uchicago.edu> University of Chicago - NSIT Web Services AIM: farmerje Jabber: farmerje@im.uchicago.edu Phone: (773)363-1058
For ajax form validation, you should consider RJS, as described at techno-weenie<http://rails.techno-weenie.net/tip/2005/11/29/ajaxed_forms_with_rjs_templates> On 1/12/06, Steve Litt <slitt@troubleshooters.com> wrote:> > On Thursday 12 January 2006 12:44 am, Jesse Farmer wrote: > > Junior Mar?al wrote: > > > Hi Folks! I''m new in the forum and i have a doubt. The button back > > > function with the Ajax on Rails? tks. > > > > A properly designed page should not use AJAX in such a way that the back > > button is broken. If you have two pages which logically should be > > referenced via different URLs, i.e., they''re actually difference > > resources, then you shouldn''t be transferring from one to the other with > > AJAX. > > > > AJAX should only be used to edit in-page items. For example, if you > > have a form which sends mail then a sensible use of AJAX would be to > > send the email asynchronously and change the input forms to a success > > message when complete. Another example would be in-place editing of > > lists, say, of bookmarks. > > How bout field level validation? > > SteveT > > Steve Litt > Author: > * Universal Troubleshooting Process courseware > * Troubleshooting Techniques of the Successful Technologist > * Rapid Learning: Secret Weapon of the Successful Technologist > Webmaster > * Troubleshooters.Com > * http://www.troubleshooters.com > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Roberto Saccon - http://rsaccon.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060112/08acfc00/attachment.html
Roberto Saccon wrote:> For ajax form validation, you should consider RJS, as described at > techno-weenie > <http://rails.techno-weenie.net/tip/2005/11/29/ajaxed_forms_with_rjs_templates>That''s pretty cool. I''ll have to look into it! -- Jesse Farmer <farmerje@uchicago.edu> University of Chicago - NSIT Web Services AIM: farmerje Jabber: farmerje@im.uchicago.edu Phone: (773)363-1058
On 1/11/06, Junior Mar?al <jcalled@gmail.com> wrote:> Hi Folks! I''m new in the forum and i have a doubt. The button back > function with the Ajax on Rails? tks.AJAX: How to Handle Bookmarks and Back Buttons by Brad Neuberg 10/26/2005 This article presents an open source JavaScript library that finally brings bookmarking and back button support to AJAX applications. By the end of this tutorial, developers will have a solution to an AJAX problem that not even Google Maps or Gmail possesses: robust, usable bookmarking and back and forward behavior that works exactly like the rest of the Web. http://www.onjava.com/pub/a/onjava/2005/10/26/ajax-handling-bookmarks-and-back-button.html> > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jon Smirl jonsmirl@gmail.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jesse Farmer wrote:> I actually think AJAX can be used to unbreak the back button. Many > times you''re in a state where going back takes you to stale data. This > can be dangerous in the case of submitting a form where there is the > potential for submitting the data twice, either by going back from the > "success" page or by hitting refresh on the "success" page, thereby > POSTing all over again.This is better solved by using redirects after a submit operation, then the update page is never available for a reload. - -- David Morton Maia Mailguard - http://www.maiamailguard.com Morton Software Design and Consulting - http://www.dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFD1raJSIxC85HZHLMRArJ1AJ0Tw9ZwwWWXJYvmqvnRlkv2VBhTEQCfWhkg +ZRGqYQA5mGcHBf9YHgIKl8=oleG -----END PGP SIGNATURE-----
I''m actually trying out this tutorial at http://www.onjava.com/pub/a/onjava/2005/10/26/ajax-handling-bookmarks-and-back-button.html and included the file dhtmlHistory.js where all the other javascript files are. but when a javascript function is called, it says ''error undefined method ''this'' in the dhtmlHistory.js library script. ''this'' is a regularly used object in js...what gives? Dominic David Morton wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Jesse Farmer wrote: > >> I actually think AJAX can be used to unbreak the back button. Many >> times you''re in a state where going back takes you to stale data. This >> can be dangerous in the case of submitting a form where there is the >> potential for submitting the data twice, either by going back from the >> "success" page or by hitting refresh on the "success" page, thereby >> POSTing all over again. > > This is better solved by using redirects after a submit operation, then > the > update page is never available for a reload. > > > - -- > David Morton > Maia Mailguard - http://www.maiamailguard.com > Morton Software Design and Consulting - http://www.dgrmm.net > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.2 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFD1raJSIxC85HZHLMRArJ1AJ0Tw9ZwwWWXJYvmqvnRlkv2VBhTEQCfWhkg > +ZRGqYQA5mGcHBf9YHgIKl8> =oleG > -----END PGP SIGNATURE------- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
oops, it was a typo, the js file loads, but gosh darnit, this seems hard. has anyone actually pulled this off adding partials to DhtmlHistory.add() ? and how would we go about this with the RoR structure and the use of iframes? Dominic wrote:> I''m actually trying out this tutorial at > http://www.onjava.com/pub/a/onjava/2005/10/26/ajax-handling-bookmarks-and-back-button.html > > and included the file dhtmlHistory.js where all the other javascript > files are. > > but when a javascript function is called, it says ''error undefined > method ''this'' in the dhtmlHistory.js library script. > > ''this'' is a regularly used object in js...what gives? > > > > Dominic > > David Morton wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Jesse Farmer wrote: >> >>> I actually think AJAX can be used to unbreak the back button. Many >>> times you''re in a state where going back takes you to stale data. This >>> can be dangerous in the case of submitting a form where there is the >>> potential for submitting the data twice, either by going back from the >>> "success" page or by hitting refresh on the "success" page, thereby >>> POSTing all over again. >> >> This is better solved by using redirects after a submit operation, then >> the >> update page is never available for a reload. >> >> >> - -- >> David Morton >> Maia Mailguard - http://www.maiamailguard.com >> Morton Software Design and Consulting - http://www.dgrmm.net >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.2 (MingW32) >> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org >> >> iD8DBQFD1raJSIxC85HZHLMRArJ1AJ0Tw9ZwwWWXJYvmqvnRlkv2VBhTEQCfWhkg >> +ZRGqYQA5mGcHBf9YHgIKl8>> =oleG >> -----END PGP SIGNATURE------- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---