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

  • Home
  • SEARCH
  • 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 8036977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:47:22+00:00 2026-06-05T02:47:22+00:00

I am trying to pass an extra variable, that determines whether or not the

  • 0

I am trying to pass an extra variable, that determines whether or not the user has clicked on a particular checkbox, and this variable is not a part of my model. I want to make it so on the controller update function, it can have access to this variable, and see what it was set to. I have seen some other stack overflow answers for this type of problem, and it is generally suggested to do something using hidden_field_tag, something like this:

<% hidden_field_tag "blah", params[:test] %>

or

<% hidden_field_tag :example, "test" %>

When trying this, I did a params.inspect and could not find the “test” param variable, using both of the above options. Should I be trying to retrieve this hidden field tag in a different way? Will it be available in the update request to the controller? If not, does anyone know some way this is possible?

Open to any suggestions,

–Anthony

  • 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-05T02:47:23+00:00Added an answer on June 5, 2026 at 2:47 am

    You would either do it like this

    <%= hidden_field_tag 'test' , 'blah' %>
    

    or you could do this

    <%= hidden_field_tag :whatever_you_want , 'blah', {:name=>'test'}
    

    You had the name and value reversed in your post. The really important thing is to make sure the form element has the name you want to show up in the params hash. The second example would generate the element with id=’whatever_you_want’ name=’test’.

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

Sidebar

Related Questions

Trying to pass in a user supplied string which has a path to the
I am having trouble trying to pass an extra variable in the url to
Trying to pass the values but not making progress. Scenario : Have a public
Trying to pass something to something else. Says undefined. Not sure how or why.
(Edit: I've since realised that perhaps it's not possible to pass arrays as parameters
I am trying to pass some extra data when I pass an intent to
I am trying to pass an extra value out of my index and I
I'm trying to implement a multi-pass rendering method using OpenSceneGraph. However, I'm not entirely
I am trying pass class as value in hashmap. I need to get the
Trying to pass a string argument to a function, which will then be used

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.