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 8184025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:21:34+00:00 2026-06-07T01:21:34+00:00

I would be grateful if somebody could help me out with the following problem.

  • 0

I would be grateful if somebody could help me out with the following problem.

I have the following form:

new_book form

<% remote_form_for @book, :url => { :controller => "books", :action => "create_sub_book"} do |f| %>
    <%= f.text_field :book_name %>
    <%= f.text_field :book_publication %>

    <%= params[:id] %> <!-- I need to pass this value to create_sub_book action, which will then pass it to create_sub_book.js.rjs -->

    <p><%= f.submit 'Create'%></p>

<% end %>

*controller action *

def create_sub_book

@book = book.new(params[:book])

respond_to do |format|
  if @book.save
    format.js
  else
    flash[:notice] = "Book failed to save."
  end
end
end

**create_sub_book.js.rjs **

`page.alert(params[:id]) ## On this page I need to access the params[:id] on the 'new_book' form. This line does not work`.

Any suggestion on how to pass the params[:id] on the ‘new_book’ form to the ‘create_sub_book.js.rjs’ ??

Thanks for all your help

  • 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-07T01:21:36+00:00Added an answer on June 7, 2026 at 1:21 am

    You can use the hidden_field tag for this.

    <%= f.hidden_field :id, params[:id] %>
    

    This will get inserted in to your params hash, and then you can pass it along.

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

Sidebar

Related Questions

I would be really grateful if somebody could help me out with this.. I
I would be grateful if anybody could help me out with this. I have
I would be very grateful if someone could help me with this. I have
I would be grateful if someone could help me out with this. In my
I would be grateful if somebody could help me to find an elegant solution
I'm not the best at PHP and would be extremely grateful if somebody could
I would be grateful to find out some really weird things I have seen
I have the following scenario and would be grateful for any advice how to
I am actually new at Qt and would be grateful if someone could explain
I'm quite new on data bases and would be very grateful for some help,

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.