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 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

Related Questions

I have an app that has a tabbar at the bottom. When I select
i have an asp.net mvc app that has a form that uploads a file.
I have a WinForms app. This app has a Preferences section where the user
My app has some table cells that vary in height. The cells can also
My app has normal users: those which come through a typical signup page facebook(FB)
My IM app has to support emoticons. They are GIFs and have textual representations,
My app has a form which uses checkboxes to sort results by type and
I have built a ruby on rails app that lets users track their workouts.
I've got a page on my Python app which has a drop-down box of
I'm creating a form in a Rails 3 app that has a dropdown field.

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.