Hello all , I am a newbie to rails but thanks to the tutorials I have created in less than a week''s time a dynamic ajax enabled test page which is shown to a user when he/she logs in. I am exploring the Javascript helper class and I was wondering if there is some way to update multiple portions of a web page. For example the page has a box on the right where in a user can add some tags.Now I need to update the portion of the page which shows a listing of all user tags and also another portion of a page whose content is determined by the tags added. I use the render :partial to update the first part but I am kind of clueless about how to acheive the second update.Any ideas? Also does Rails provides a way to add a text box which basically functions like the form_remote_tag .But I want the text box to appear only when a link is clicked and also provide a link to hide it.I suspect i need to write some javascript here but I just want to know how far rails can take me. thanks vivek _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
In response to vivek : Using Ajax to do more than 1 render>>some way to update multiple portions of a web page.Sure, all kinds of ways - using dhtml and ajax - http://script.aculo.us/>> but Iam kind of clueless about how to acheive the second update.Any ideas?This might get you started - Ajax.Updater... http://wiki.script.aculo.us/scriptaculous/show/Ajax.Updater>>But I want the text box to appear only when a link >>is clicked and also provide a link to hide it.I suspect i need to write some >>javascript here but I just want to know how far rails can take me.http://wiki.script.aculo.us/scriptaculous/show/Prototype Perhaps something like this? <div id="something"><%=text_field ''user'',''something''%></div> <a href="#" onclick="Element.hide(''something'')">Hide</a> <a href="#" onclick="Element.show(''something'')">Show</a> <a href="#" onclick="Element.toggle(''something'')">Flipper</a> Something like that :P
On 12/2/05, Vivek Krishna <krishna.vivek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all , > I am a newbie to rails but thanks to the tutorials I have created in less > than a week''s time a dynamic ajax enabled test page which is shown to a user > when he/she logs in. I am exploring the Javascript helper class and I was > wondering if there is some way to update multiple portions of a web page. > > For example the page has a box on the right where in a user can add some > tags.Now I need to update the portion of the page which shows a listing of > all user tags and also another portion of a page whose content is determined > by the tags added. I use the render :partial to update the first part but I > am kind of clueless about how to acheive the second update.Any ideas? > > Also does Rails provides a way to add a text box which basically functions > like the form_remote_tag .But I want the text box to appear only when a link > is clicked and also provide a link to hide it.I suspect i need to write some > javascript here but I just want to know how far rails can take me. > > thanks > vivekRails can take you all the way from here to the moon and back. You''ll have to use #update_element_function [1] to update multiple regions. RJS templates[2] make this a lot easier. As for text boxes, scriptaculous provides the In-Place Editor [3]. Otherwise you can just write your own js to toggle the textbox on the click of a link. 1. http://rails.rubyonrails.com/classes/ActionView/Helpers/JavaScriptHelper.html#M000430 2. http://rails.techno-weenie.net/tip/2005/11/29/ajaxed_forms_with_rjs_templates 3. http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor -- rick http://techno-weenie.net