You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I am stuck here. I see no class of "presence" added to my radio's. That seems to be the problem, but I am not sure why.
If I change to validation_presence_of :category_id
to ensure a category radio button is picked, a Javascript error is thrown about an illegal character... but the radios are rendered with the "presence" class.
How to get radio's generated like this to validate?
The text was updated successfully, but these errors were encountered:
For sure there is a problem... using the belongs_to association causes an error in the way the javascript tries to hook in to the validation. I am sure it is simply off by an _id or something.
i'm seeing a similar problem here... maybe it's a result of formtastic wrapping labels around the radio input elements (instead of putting them after like validatious examples show) - just a guess
Problem seems to from my setup as follows: Post belongs_to :category. I use HAML for templates.
class Post < ActiveRecord::Base
belongs_to :category
validates_presence_of :category
So now, in Formtastic I am displaying some radio buttons for category via the Formtastic setup:
= form.input :category, :as => :radio
which generates the radio buttons. Pressing submit however does not validate that a radio was selected, and by default none is selected.
The generated HTML is:
So I am stuck here. I see no class of "presence" added to my radio's. That seems to be the problem, but I am not sure why.
If I change to validation_presence_of :category_id
to ensure a category radio button is picked, a Javascript error is thrown about an illegal character... but the radios are rendered with the "presence" class.
How to get radio's generated like this to validate?
The text was updated successfully, but these errors were encountered: