<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7174759320464139382</id><updated>2024-09-01T01:31:32.848-07:00</updated><title type='text'>Rails - RJS Made Easy To Use</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://krunal-rjs-examples.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7174759320464139382/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://krunal-rjs-examples.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Krunal Shah</name><uri>http://www.blogger.com/profile/08229248961934158256</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOoLKB-OqA1JM_6WOXkJ9SwZ8HTuR3SwwzynCRC99r0_l-rSzQNOGDQBLFmnXxe0jsiHOe5UPpC2tcPmMdbqm5DKKwEoQkz1CG-woP6PefcirewjDEcv9L3jmmARMMoSI/s220/kru.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7174759320464139382.post-5154108527111680906</id><published>2009-10-30T06:57:00.000-07:00</published><updated>2010-01-06T23:47:19.675-08:00</updated><title type='text'>RJS - Made Easy With Examples</title><content type='html'>&lt;meta content=&quot;text/html; charset=utf-8&quot; equiv=&quot;CONTENT-TYPE&quot;&gt;&lt;/meta&gt; 	&lt;title&gt;&lt;/title&gt; 	&lt;meta content=&quot;OpenOffice.org 3.0  (Linux)&quot; name=&quot;GENERATOR&quot;&gt;&lt;/meta&gt; 	&lt;style type=&quot;text/css&quot;&gt;
 	&lt;!-- 		@page { margin: 2cm } 		PRE { font-family: &quot;Liberation Serif&quot; } 		P { margin-bottom: 0.21cm } 	--&gt; 	
&lt;/style&gt;  &lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;color: #3333ff; font-size: 180%; font-weight: bold;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;Rails RJS examples.&lt;/span&gt;  &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&lt;span style=&quot;font-size: 180%;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&lt;span style=&quot;font-size: 180%;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&lt;span style=&quot;font-size: 180%;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;With RJS we can give a better look our site.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;

&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;I will show different examples which can help you to use
RJS for your site.&lt;/span&gt;&lt;/span&gt;

&lt;span style=&quot;font-size: 180%;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;::Examples::&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-size: 180%;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;------------&lt;/span&gt;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-size: 130%; font-weight: bold;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;1) Show,Hide functionality with RJS.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-size: 130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; &lt;/span&gt;
&amp;lt;%= link_to_function &quot;Edit&quot; do |page|
page[:postbulletin].show; 
page[:error_messages].hide; %&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: maroon; font-size: 130%; font-weight: bold;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;2) How to pass value to the specific field with RJS.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-size: 130%;&quot;&gt;
&amp;lt;%= link_to_function &quot;Edit&quot; do |page|
page[:bulletin_title].value = bulletin.title; %&amp;gt;

&lt;/span&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon; font-size: 130%; font-weight: bold;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;3) Write condition in block while using RJS.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-size: 130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;   &lt;/span&gt;
&amp;lt;%= link_to_function &quot;Edit&quot; do  |page|
(bulletin.video_id != 0) ?
page[:addupdatevideo1].hide : page[:addupdatevideo1].show; %&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: maroon; font-size: 130%; font-weight: bold;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;4) Pass patial with RJS from view side.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-size: 130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; &lt;/span&gt;
&amp;lt;%= link_to_function &quot;Edit&quot; do |page| 
[:addupdatevideo].innerHTML =
render :partial =&amp;gt; &#39;users/get_video&#39;; %&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: maroon; font-size: 130%; font-weight: bold;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;5) Add and remove class to the specific div or html tag with RJS.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-size: 130%;&quot;&gt;
&amp;lt;%= link_to_function &quot;Edit&quot; do  |page| 
page[:a_sort_by_music].removeClassName(&quot;selected&quot;);
page[&quot;a_sort_by_#{info}&quot;].addClassName(&quot;selected&quot;); %&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-size: 130%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: maroon; font-size: 130%; font-weight: bold;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;6) Remove div from your view and give visual effect from
your view with RJS.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-size: 130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;   &lt;/span&gt;
&amp;lt;%= link_to_function &quot;Edit&quot; do |page|
page[:editvideodetail].remove %&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-size: 130%;&quot;&gt;
&amp;lt;%= link_to_function &quot;Edit&quot; do |page|
page[&quot;editvideodetail&quot;].visual_effect(:highlight); %&amp;gt; &lt;/span&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: maroon; font-size: 130%; font-weight: bold;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;7) Replace content of your div with RJS.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; &lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-size: 130%;&quot;&gt;
&amp;lt;%= link_to_function page.replace &quot;showvideodetail&quot;,
:partial =&amp;gt; &#39;edit_video_detail&#39;; %&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-size: 130%;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon; font-size: 130%; font-weight: bold;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;8) Insert a content to specific div with RJS with condition.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-size: 130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;
&lt;/span&gt;&amp;lt;%= link_to_function &quot;Edit&quot; do |page|   
page[&quot;video_#{@video.id}&quot;].innerHTML = 
@video.is_featured ?  &quot;This video has been featured.&quot; :
&quot;This video has been unfeatured.&quot;; %&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: maroon; font-size: 130%; font-weight: bold;&quot;&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%;&quot;&gt;9) If condition with RJS.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;  &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; font-size: small;&quot;&gt;

render :update do |page|&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-family: arial; font-size: small;&quot;&gt;
page &amp;lt;&amp;lt; &quot;if ($(&#39;editvideodetail&#39;)) {&quot;&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-family: arial; font-size: small;&quot;&gt;
page.replace &quot;editvideodetail&quot;, :partial =&amp;gt; &#39;show_video_detail&#39;&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-family: arial; font-size: small;&quot;&gt;
page[&quot;showvideodetail&quot;].visual_effect(:highlight)&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-family: arial; font-size: small;&quot;&gt;
page &amp;lt;&amp;lt; &quot;} else { if ($(&#39;showvideodetail&#39;)) {&quot;&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-family: arial; font-size: small;&quot;&gt;
page[:showvideodetail].remove&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-family: arial; font-size: small;&quot;&gt;
page &amp;lt;&amp;lt; &quot;}&quot;&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-family: arial; font-size: small;&quot;&gt;
page.insert_html :after,&quot;video_id_#{params[:id]}&quot;, :partial =&amp;gt; &#39;show_video_detail&#39;&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-family: arial; font-size: small;&quot;&gt;
page[&quot;video_id_#{params[:id]}&quot;].visual_effect(:highlight)&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-family: arial; font-size: small;&quot;&gt;
page &amp;lt;&amp;lt; &quot;}&quot;&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: transparent none repeat scroll 0% 0%; font-family: arial; font-size: small;&quot;&gt;
end&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: small;&quot;&gt;  &lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://krunal-rjs-examples.blogspot.com/feeds/5154108527111680906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krunal-rjs-examples.blogspot.com/2009/10/rjs-made-easy-with-examples.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7174759320464139382/posts/default/5154108527111680906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7174759320464139382/posts/default/5154108527111680906'/><link rel='alternate' type='text/html' href='http://krunal-rjs-examples.blogspot.com/2009/10/rjs-made-easy-with-examples.html' title='RJS - Made Easy With Examples'/><author><name>Krunal Shah</name><uri>http://www.blogger.com/profile/08229248961934158256</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOoLKB-OqA1JM_6WOXkJ9SwZ8HTuR3SwwzynCRC99r0_l-rSzQNOGDQBLFmnXxe0jsiHOe5UPpC2tcPmMdbqm5DKKwEoQkz1CG-woP6PefcirewjDEcv9L3jmmARMMoSI/s220/kru.jpg'/></author><thr:total>0</thr:total></entry></feed>