tags:

views:

66

answers:

1

I need to submit a hash of attributes directly from the form tag. Is this possible?

<form action="/members/1/comments" method="post">
  [some element] {"coordinator\_id"=>"1", "time"=>"1230", "info_link"=>"cnn.com"}
  <submit>Post</submit>
</form>

This hash should arrive as 'comment' => {"coordinator_id"=>"1", "time"=>"1230", "info_link"=>"cnn.com"}

+1  A: 

Almost possible, but not recommended, you should give your values proper names instead, but here is what you asked for:

<form action="/members/1/comments" method="post">
  <input name="comment[coordinator_id]" type="hidden" value="1" />
  <input name="comment[time]" type="hidden" value="1230" />
  <input name="comment[info_link]" type="hidden" value="cnn.com" />
  <submit>Post</submit>
</form>
soulmerge
Yes, this would be the, but this hash is deeply nested and complicated. It's already formatted for the server. I just need to send it up without any work just comment[big_nasty_hash].
Gavin
I'm sorry to disappoint you, but you will have to actually do *work* in this case.
soulmerge