blacklight icon indicating copy to clipboard operation
blacklight copied to clipboard

Having trouble passing value from radio button when submit

Open estherylau opened this issue 15 years ago • 2 comments

Hi,

I am using your default blacklight application trying to create radio button instead of a drop down. I am not able to to pass radio button value after I submit the form. Non of the radio button would selected. I was trying to create params as suggested in many forum but have no luck. I put the params in catalog_controller.rb. Please help.

Here is my code:

_search_form.html.erb

<%= radio_button_tag :search_field, 'title' %> <%= label_tag :title, "Title" %> <%= radio_button_tag :search_field,'author' %> <%= label_tag :author, "Author" %> <%= radio_button_tag :search_field, 'subject' %> <%= label_tag :subject, "Subject" %>

catalog_controller.rb

class CatalogController < ApplicationController

include Blacklight::Catalog

def _search_form @searchfield = params[:search_field] end

end

estherylau avatar Sep 27 '11 20:09 estherylau

Have you tried def index in the catalog controller rather than def '_search_form'?

pristinenoise avatar Mar 19 '12 17:03 pristinenoise

Closing for lack of feedback. Also, sounds like a question about Rails mechanics better answered on-list.

cbeer avatar Oct 10 '12 15:10 cbeer