I'm trying to find an effective way to validate the following:

I have 3 form fields, a select menu a checkbox and a textfield. They can
all be left blank on submission, but if you select two or more  it
should prompt an error. If the user chooses to,  only one field should
be allowed to be submitted.

I tried the following but it seems to be breaking my cucumber scenario.
Only the first if statement works. The rest are breaking the scenario.

     if !database.blank? and !auto_generate_database.blank? and
!snapshot_id.blank?
        errors[:Database_Selection]  = msg
      elsif !database.blank? and !auto_generate_database.blank?
        errors[:Database_Selection]  = msg
      elsif !snapshot_id.blank? and !database.blank?
        errors[:Database_Selection]  = msg
      elsif !auto_generate_database.blank? and !snapshot_id.blank?
        errors[:Database_Selection]  = msg
      end

Any input is greatly appreciated.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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.

Reply via email to