All pastes #15792 Raw Edit

Anonymous

public text v1 · immutable
#15792 ·published 2005-06-24 19:55 UTC
rendered paste body
Generated HTML:
<input id="check2_done" name="check2[done]" type="checkbox" value="1" /><input name="check2[done]" type="hidden" value="0" />
<script type="text/javascript">new Form.Element.Observer('check2', 0.25, function(element, value) {new Ajax.Updater('success2', '/railstest/public/todo/live_check/2', {parameters:value, asynchronous:true})})</script>
<!-- <input id="item_done" name="item[done]" onclick="document.location.href='/railstest/public/todo/live_check/2'" type="checkbox" value="1" /><input name="item[done]" type="hidden" value="0" /> -->
<input id="text2" name="text2" size="40" type="text" value="Learn Rails" />
<script type="text/javascript">new Form.Element.Observer('text2', 0.5, function(element, value) {new Ajax.Updater('success2', '/railstest/public/todo/live_update/2', {parameters:'description=' + escape(value), asynchronous:true})})</script>
<!-- <a href="/railstest/public/todo/edit/2">Edit</a> -->
<a href="/railstest/public/todo/destroy/2" onclick="return confirm('Are you sure you want to delete this entry: Learn Rails');">Destroy</a>
<div id="success2"></div>
<br>

Portion of the view:
<% @item = display %>
<% divname = "success" + @item.id.to_s %>
<% textname = "text" + @item.id.to_s %>
<% checkname = "check" + @item.id.to_s %>
<%= check_box( checkname, "done" ) %>
<%= observe_field(checkname,
                :update => divname,
                :frequency => 0.25,
                :url => { :action => :live_check, :id => @item.id }) %>
<!-- <%= check_box("item", "done", "onclick" => "document.location.href='/railstest/public/todo/live_check/#{@item.id}'") %> -->
<%= text_field_tag(textname, @item.description, :size => 40) %>
<%= observe_field(textname,
                 :frequency => 0.5,
                 :update => divname,
                 :url => { :action => :live_update, :id => @item.id },
                 :with => "'description=' + escape(value)") %>
<!-- <%= link_to("Edit", :action => "edit", :id => @item.id) %> -->
<%= link_to("Destroy", { :action => "destroy", :id => @item.id },
:confirm => "Are you sure you want to delete this entry: #{@item.description}") %>
<div id="<%= divname %>"></div>
<br>