suneeta
February 28, 2008, 5:56am
1
I have an edit_func_spec_ui.rhtml file in the controller
popup_controller:
Edit Functional
Specification
<%= text_area "ci_content",
"functional_spec", "cols" => 120, "rows" => 5 %>
<%= link_to ( "Save", {:controller => :ci, :action =>
:edit_ci_functional_spec, :ci => @ci, :method => 'post'}, {'class' =>
'itilbuttonlink1'})%>
<%= link_to ( "Cancel", {:controller => :ci, :action => :edit, :ci =>
@ci}, {'class' => 'itilbuttonlink1'})%>
The link “Save” calls an action edit_ci_functional_spec in another
controller ci_controller:
def edit_ci_functional_spec
@ci = Ci.find(params[:ci])
@ci.content.functional_spec= params[:ci_content][:functional_spec]
@ci.content.save
redirect_to :action => ‘edit’, :ci => @ci
end
But i’m not getting the value of params[:ci_content][:functional_spec]
in the above action. Anyone please help me to solve this.
Thanks in advance
Suneeta
suneeta
February 28, 2008, 9:14am
2
‘itilbuttonlink1’})%>
But i’m not getting the value of params[:ci_content][:functional_spec]
in the above action. Anyone please help me to solve this.
Why would it? Save is just a link and fuctional_spec is a textfield
elsewhere on the page. Sounds like you want a form instead.
Fred
suneeta
February 29, 2008, 4:58am
3
Suneeta Km wrote:
<%= link_to ( “Save”, {:controller => :ci, :action =>
:edit_ci_functional_spec, :ci => @ci , :method => ‘post’}, {‘class’ =>
‘itilbuttonlink1’})%>
@ci.content.functional_spec= params[:ci_content][:functional_spec]
@ci.content.save
redirect_to :action => ‘edit’, :ci => @ci
end
But i’m not getting the value of params[:ci_content][:functional_spec]
in the above action. Anyone please help me to solve this.
Thanks in advance
Suneeta
Where in the above link_to method do you see yourself setting the
params[:ci_content][:functional_spec]…
You are setting the params[:ci] (which you grab later but not the
former)
hth
ilan
suneeta
February 29, 2008, 12:19pm
4
<%= link_to ( “Save”, {:controller => :ci, :action =>
:edit_ci_functional_spec, :ci => @ci , :method => ‘post’}, {‘class’ =>
‘itilbuttonlink1’})%>
You cannot post form variables without using form. It’ll be better to
use form and submit button instead of links.
Thanks
Buttons are not customizable enough for me. I used something like that
link_to “Submit”, 'javascript:document.forms[0].submit(); ',
:class=>“button”