Steve Q
Steve Q

Reputation: 395

Multiple Buttons (not submit) in form rails 3

This is a generalized question. I'm not asking one to write any code for me, I just can't quite wrap my head around this.

I know about f.button but from what I can tell that just acts as a submit button and refreshes things. I've also tried button_tag, but I can't get that working properly either.

I have a Rating form that user's use to submit information (duh). I have 3 different categories that a user can rate "Good" "Ok" "Bad". The "Good", "Ok", "Bad" I would like to be buttons that the user can click and then once that form is submitted this rating goes into the database next to the category. Each time a user submits the rating form they will rate all 3 categories as either "Good", "Ok", "Bad".

A rating belongs to a user and a user has_many ratings.

Example When someone submits the rating form I'd want it to look like this:

ID  Category 1      Category 2     Category 3    User ID
1    Good              Ok             Good         1

Does this make sense? Is this possible to do?

Upvotes: 0

Views: 151

Answers (1)

mu is too short
mu is too short

Reputation: 434935

jQuery UI offers some wrapping for standard radio buttons that makes them look like a single button split into several parts. See the radio button section of the button demo:

http://jqueryui.com/button/#radio

Upvotes: 1

Related Questions