Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8633617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:31:19+00:00 2026-06-12T09:31:19+00:00

I am trying to add a jquery upload But i need to pass a

  • 0

I am trying to add a jquery upload
But i need to pass a parameter into my form

Here the form

<%= form_for Photo.new do |f|%>
  <%= f.label :title %><br />
  <%= f.text_area :title, :rows => 3, :value => "Add a photo", :onclick=>"this.value='';" %>
  <%= f.file_field :photo, multiple: true %>
  <%= f.hidden_field('event_id', params[:event_id]) %>
  <%= f.submit "Add Picture" %>
<% end %>

But this doesn’t work, the issue is I have a link has follow
localhost/events/16/photos/useradd

where 16 is the event_id params. How can i place it into my hidden field so it is send afterwards?

UPDATE

NoMethodError in Photos#useradd
Showing /home/jean/rail/voix/app/views/photos/useradd.html.erb where line #13 raised:
undefined method `merge' for "16":String

that the error and 16 is my event_id

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:31:20+00:00Added an answer on June 12, 2026 at 9:31 am

    Ok, shot in the dark here:

    Try

    <%= f.hidden_field 'event_id', :value => params[:event_id] %>
    

    Edit – Why it worked:

    The hidden_field method has the following signature: hidden_field(object_name, method, options = {})
    See the docs about hidden_field

    You have passed the value 16 as a method to be called by hidden_field, and that would not work.

    The third argument of hidden_field is a options hash. Setting the “value” field of that hash will set the value of the input tag generated by the helper, and thus effectively setting ’16’ as the value of that form field. 🙂

    Best regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add a file upload function to a contact form, but it
I am trying to upload images on a form but I am using Jquery
I'm trying to add jQuery using Greasemonkey's @require / @include method, but it doesn't
Im trying to add a Jquery validation script to a form plugin for wordpress.
I am trying to add the functionality of adding jquery into an application. I
i am trying to add jquery dtepciker to my application in Grails(Intelli J) but
i am bit new to jQuery and I am trying to add a jQuery
I'm trying to add classes via jQuery. Funny thing is, last-child works but first-child
am trying to add jQuery Grid into my application(C# and Asp.net) using samples provided
Im trying to add jQuery to one of my projects, but can't get it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.