Hi
On every list request i render an item partial through a collection of
items. the item table has 3 columns namely name,anotherName and id. the
item partial looks like
<%@item=item%>
<%= error_messages_for(:item) %>
<tr id="<%=item.id%>">
<% for column in Item.content_columns %>
<td><%=h item.send(column.name) %></td>
<% end %>
<td><%= link_to ''Show'', :action =>
''show'', :id => item %></td>
<td><%= link_to_remote(''Edit'',
:update=>item.id,:url=>{ :action =>
''ajax_edit'', :id => item}) %></td>
<td><%=
link_to_remote(''Destroy'',:update=>item.id,
:url=>{:action
=>:ajax_destroy, :id => item}, :confirm => ''Are you
sure?'') %></td>
</tr>
I have an edit link in the form of link_to_remote with the update
option set to the same element. the idea is to display an update form at
the same position as that of the original item.
ajax_edit action of the item_controller renders the partial form for
doing so.
def ajax_edit
@item=Item.find(params[:id])
render(:partial=>"form",:locals=>{:item=>@item,:actionName=>"ajax_update",:updateID=>"items",:submitTag=>"update"})
end
_form.rhtml would look like this
<%=
form_remote_tag(:update=>updateID,:position=>:bottom,:url=>{:action
=> actionName})%>
<%= text_field_tag(''itemName'',item.name) %>
<%= text_field_tag(''itemAName'',item.anotherName) %>
<%=hidden_field(''item'',:id)%>
<%= submit_tag (submitTag+" item") %>
<%= end_form_tag %>
I have two problems
1) when i click on edit, the form partial is not rendered completely.
both the second text field and the submit_tag are not visible. moreover,
the first visible textfield is overwritten by the element which was
previously present below it. note that the render of the form is
accomplished successfully if i pass on the update id of a new DOM element
2) the hidden field values are received in some kindoff hash on the
controller side. how do i access them??
thanks in advance
shodhan
Hi
On every list request i render an item partial through a collection of
items. the item table has 3 columns namely name,anotherName and id. the
item partial looks like
<%@item=item%>
<%= error_messages_for(:item) %>
<tr id="<%=item.id%>">
<% for column in Item.content_columns %>
<td><%=h item.send(column.name) %></td>
<% end %>
<td><%= link_to ''Show'', :action =>
''show'', :id => item %></td>
<td><%= link_to_remote(''Edit'',
:update=>item.id,:url=>{ :action =>
''ajax_edit'', :id => item}) %></td>
<td><%=
link_to_remote(''Destroy'',:update=>item.id,
:url=>{:action
=>:ajax_destroy, :id => item}, :confirm => ''Are you
sure?'') %></td>
</tr>
I have an edit link in the form of link_to_remote with the update
option set to the same element. the idea is to display an update form at
the same position as that of the original item.
ajax_edit action of the item_controller renders the partial form for
doing so.
def ajax_edit
@item=Item.find(params[:id])
render(:partial=>"form",:locals=>{:item=>@item,:actionName=>"ajax_update",:updateID=>"items",:submitTag=>"update"})
end
_form.rhtml would look like this
<%=
form_remote_tag(:update=>updateID,:position=>:bottom,:url=>{:action
=> actionName})%>
<%= text_field_tag(''itemName'',item.name) %>
<%= text_field_tag(''itemAName'',item.anotherName) %>
<%=hidden_field(''item'',:id)%>
<%= submit_tag (submitTag+" item") %>
<%= end_form_tag %>
I have two problems
1) when i click on edit, the form partial is not rendered completely.
both the second text field and the submit_tag are not visible. moreover,
the first visible textfield is overwritten by the element which was
previously present below it. note that the render of the form is
accomplished successfully if i pass on the update id of a new DOM element
2) the hidden field values are received in some kindoff hash on the
controller side. how do i access them??
thanks in advance
shodhan
Are you showing the same code with which you were having problems? I see a lot of things happening which look like simple mistakes or typos, so I have a feeling I''m not looking at the right code ... Could you describe what you''re trying to do exactly? This is not entirely clear to me. - Rowan On 8/15/05, shodhan <shodhan_sheth-BI6C26+1BusSpmxQ0ygm9Q@public.gmane.org> wrote:> Hi > On every list request i render an item partial through a collection of > items. the item table has 3 columns namely name,anotherName and id. the > item partial looks like > > <%@item=item%> > <%= error_messages_for(:item) %> > <tr id="<%=item.id%>"> > <% for column in Item.content_columns %> > <td><%=h item.send(column.name) %></td> > <% end %> > <td><%= link_to ''Show'', :action => ''show'', :id => item %></td> > <td><%= link_to_remote(''Edit'', :update=>item.id,:url=>{ :action => > ''ajax_edit'', :id => item}) %></td> > <td><%= link_to_remote(''Destroy'',:update=>item.id, :url=>{:action > =>:ajax_destroy, :id => item}, :confirm => ''Are you sure?'') %></td> > </tr> > > I have an edit link in the form of link_to_remote with the update > option set to the same element. the idea is to display an update form at > the same position as that of the original item. > ajax_edit action of the item_controller renders the partial form for > doing so. > > def ajax_edit > @item=Item.find(params[:id]) > render(:partial=>"form",:locals=>{:item=>@item,:actionName=>"ajax_update",:updateID=>"items",:submitTag=>"update"}) > end > > _form.rhtml would look like this > > <%= form_remote_tag(:update=>updateID,:position=>:bottom,:url=>{:action > => actionName})%> > <%= text_field_tag(''itemName'',item.name) %> > <%= text_field_tag(''itemAName'',item.anotherName) %> > <%=hidden_field(''item'',:id)%> > <%= submit_tag (submitTag+" item") %> > <%= end_form_tag %> > > I have two problems > 1) when i click on edit, the form partial is not rendered completely. > both the second text field and the submit_tag are not visible. moreover, > the first visible textfield is overwritten by the element which was > previously present below it. note that the render of the form is > accomplished successfully if i pass on the update id of a new DOM element > 2) the hidden field values are received in some kindoff hash on the > controller side. how do i access them?? > thanks in advance > shodhan > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Morality is usually taught by the immoral.