Simple Form drop down menu, string selection

Mel

I use simple form with my rails 4 app.

I have a show page in my app with this identifier for location:

<div class="datasubtextq">Location:
        <span class="datasubtexta">
          <% if @project.scope.try(:participant).try(:location_specific) == true %>
            <%= render @project.scope.try(:participant).try(:location) %>
          <% else %>
            <%= render :text => "Remote participation sought" %>
          <% end %>
        </span>
  </div>

In my form, I ask users to select a location, as follows:

                    <%= par.input :location, label: 'Where will participants take part in this project?', label_html: {class: 'response-project'}, collection: [ "Brisbane", "Melbourne", "Sydney" ], prompt: "Choose one" %>

When I test this, I get the following error:

The partial name (Brisbane) is not a valid Ruby identifier; make sure your partial name starts with a lowercase letter or underscore, and is followed by any combination of letters, numbers and underscores.

How do I ask for the show form to reflect the location selection made in the form?

Thank you

Aguardientico

If you read the error you get, you can see the issue is related to try to render a partial that does not exists and is ok, to fix the issue change

<%= render @project.scope.try(:participant).try(:location) %>

with

<%= @project.scope.try(:participant).try(:location) %>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

form drop-down selection based input trigger in jquery

Assigning JavaScript variables with HTML drop-down menu (user selection)

Multi selection drop down menu

How to manipulate/set reactions to the selection of a drop down menu?

Issue with R Shiny, Leaflet --> SelectInput to Change Selection in Drop Down Menu

Style dijit.form.Select drop down menu

populate a second drop down menu depends upon first drop down selection

Submit form by clicking on drop down menu item

How to validate a drop down menu in a form?

Run SQL query and update form on drop-down selection

Change form action on drop down selection

Auto populate fields in a PHP form with a Drop down selection

drop down menu looks weird in form? (with javascript)

Loading an Iframe src with selection from horizontal drop down menu

Show form fields dependent on drop down box selection

How to have fields in a form pre-populate based on a drop-down menu selection using JQuery

Submit form content to department based on drop down selection

Create a drop down menu in a form being created with php

I need drop down menu to close after # selection in mobile

Change sign-up form depending on the drop down-menu?

Rails: creating a drop down menu for a form

Displaying a number based on drop down menu selection

How to populate the form fields based on drop down selection?

Drop Down menu selection does not navigate to link

How to make drop down menu reflect the form action in PHP and HTML?

Scraping from a page where the value is a selection fro a drop down menu

Disable Button on Access Form Based on Drop Down Selection

RSelenium Drop-Down Menu Selection

Custom Menu in UI - selection changes selection in drop down list