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

The Archive Base Latest Questions

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

I am trying to make a form to create a new product. At the

  • 0

I am trying to make a form to create a new product. At the top of the page, I want one to be able to choose what type of product it is, and one that is done a form will populate below with the correct fields (and at any point, one could change the product type)

My assumption is that I should use jQuery and AJAX to render a different partial for each one – that is, if the user selects a product type, then the corresponding form loads a partial that has the appropriate form without a page refresh.

Like in my previous posts, my first question is just to make sure this is acceptable in the rails community.

However, ironically my problem is not with the AJAX or the jQuery but the partial. I created a partial for “shirt” titled “_shirt.html.erb” that looks like below:

<% form_for(:shirt, :url => { :action => 'save_to_session' } ) do |f| %>
<table summary="Shirt form fields">
<tr>    
    <th>Shirt Size S:</th>
</tr>
<tr>
    <td><%= f.select(:size_s, 0..99) %> </td>
</tr>
</table>

  <%= submit_tag("Create Item") %>  
<% end %>

and in my view, I am just trying to render the partial with

<%= render "shirt" %>

but when the page loads, it does not load the form. The body is empty except for a link from the layout. I looked online and could not find what could be wrong with this, any ideas?

  • 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-17T09:31:39+00:00Added an answer on June 17, 2026 at 9:31 am

    Rendering a form this way is no necessarily “conventional” but if your application requires this functionality then I would not let rails hold you to a certain functionality. In my opinion you should of course follow rails convention as much as possible but should not let that be a limiting factor.

    As far as the form not rendering I believe you just have to add a = to the form tag so it should be:

    <%= form_for(:shirt, :url => { :action => 'save_to_session' } ) do |f| %>
    

    instead of

    <% form_for(:shirt, :url => { :action => 'save_to_session' } ) do |f| %>
    

    Hope this helps!

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

Sidebar

Related Questions

I'm trying to create a single page form to create a 'work item'. One
I'm trying to to make a form that will submit a new record and
I am trying to make a form using two drop down select menus: one
I am trying to make a form field for a datetime property that allows
I'm fairly new to javascript and I'm trying to make an form for my
I'm trying to make an AJAX form that will update a twitter status when
I'm trying to make a form that handles the checking of a domain: the
1st Question: I'm trying to make the create method work, but it appears that
I'm trying to make a simple custom field field_book_year for the new node type
I am trying to create a form with Sencha Touch that will create a

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.