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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:12:06+00:00 2026-05-11T14:12:06+00:00

My app has a select box for users to choose a venue. This select

  • 0

My app has a select box for users to choose a ‘venue’. This select box is, as you would expect, in a form. I also have an action somewhere on the page that creates a new venue via AJAX. After the new venue is created, I would like to updated the venue select box to reflect this.

My solution was to put the select box in a partial and render the partial from the create action in the controller.

 <div id='venue_select' style='clear: both;'>     <%= render :partial => 'venue/venue_select_box' %>  </div> 

The partial looks like this:

<%= f.collection_select :venue_id, @user_venues, :id, :name, :prompt => 'Select a venue' %> 

where f is the form reference:

<% form_for :shows do |f| %> 

The problem is that f is undefined in the partial, so I get an error. One solution would be to include the entire form, but I feel like that should not be necessary because I am not updating the entire form. Any ideas on how to go about this?

  • 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. 2026-05-11T14:12:07+00:00Added an answer on May 11, 2026 at 2:12 pm

    These are all great options but I think I found the easiest. Basically, I just hard coded the name in the collection_select so I would not need the ‘f’ variable:

    <%= collection_select 'shows[venue_id]', :venue_id, @user_venues, :id, :name, { :prompt => 'Select one of your previous venues' } %> 

    Then my VenueController is as follows:

    class VenueController < ApplicationController   layout 'main'   before_filter :login_required, :get_user    def create     begin       venue = @user.venues.create(params[:venue])       @user_venues = @user.venues       render :partial => 'venue_select_box', :success => true, :status => :ok     rescue ActiveRecord::RecordInvalid => invalid       flash[:errors] = invalid.record.errors       render :text => '', :success => false, :status => :unprocessable_entity     end   end  end 

    If this method is bad practice for any reason, please let me know and I will happily credit you for the answer.

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

Sidebar

Ask A Question

Stats

  • Questions 285k
  • Answers 285k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As far as I can tell, it's not supported. I… May 13, 2026 at 4:47 pm
  • Editorial Team
    Editorial Team added an answer Did a first pass of fixes on your code: template… May 13, 2026 at 4:46 pm
  • Editorial Team
    Editorial Team added an answer There's quite an extensive article on this on MSDN, Getting… May 13, 2026 at 4:46 pm

Related Questions

Right now I have an app that allows a user to pick a ring
I have a very simple webforms app that will allow field techs to order
I'm developing an iPhone app. I need to create a Quiz application that has
The question, in brief: In MVC, how do you distinguish between a checkbox click

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.