On 15 February 2011 12:39, Piotroslav <piotros...@gmail.com> wrote: > Hello! > > I am trying to validate presence of one of two form fields. > I want to check if there is only one from two possible checkbox > selected. > I tried to find any hints in documentation, but as a beginner I wasn't > able to invent solution.
Validation is not on form fields but on data about to be saved to the database. Do you have two columns in the table, one for each checkbox? If so, and only one of them should be selected then reduce it to a single column. As far as the form is concerned you may be better with a radio box as Amador has suggested. If you need them to be checkboxes you could use javascript to clear one when the other is selected. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.