I need to submit a form to an external URL, so I have this:
form_for(@task, :url => "https://www.external.com/Submit") do |f|)
<%= f.hidden_field :assignmentId, :value => @assignment %>
<%= link_to image_tag(@imagelocation) %>
....
I am using form_for
, because I need to access to my controller variables.
The external server looks for a param, assignmentId
. When the form is submitted, the param is actually available as
params[:task][:assignmentId]
which fails to pass validation on the external server.
How do I resolve this? How do I access variables from my controller and pass 'naked' params to the external server?
[edit] Here's what the submit params looks like
utf8=%E2%9C%93&_method=put&task%5BassignmentId%5D=2LVQ39Z0B6UWI8NXYWJTYRKGQXIMXN&task%5Boutput%5D=carpet&commit=Post
I want it to not have the task referenced.
Use hidden_field_tag
instead of f.hidden_field
. Btw, if you want this field to store assignment's id, you should use @assignment.id
, not just @assignment
.
<%= hidden_field_tag :assignmentId, @assignment.id %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With