1

I have a user model that has many fields (let's say 30 for this example). When the user signs up, I only fill in the first 10. Once they have logged in and they want to complete their info, they have two pages that allow them to complete the rest (one page handles 11-20 and the other handles 21-30).

So, when they hit the first page that handles 11-20, I want to make sure they fill in all of the fields (they shouldn't just choose to answer 3 of them and leave the rest "Please choose").

Same thing for the second page that handles 21-30.

What would be the best way to handle this? I'm using rails 3.1 with activerecord. If I do something simple like add the following to my model, I can't create the user without filling in all of the fields ("validates :user_summary, :presence => true").

Thanks!

Jason
  • 545
  • 1
  • 4
  • 10
  • [This other stackoverflow thread][1] might help [1]: http://stackoverflow.com/questions/2603464/how-to-create-wizard-forms-in-ruby-on-rails – leonardoborges Dec 16 '11 at 13:55
  • One idea I had was to create two models. One for the User. And one for the User additional and non-preliminary information. So that in the 2-3 pages, you have validation requirements in your Models. Not sure if this is the best idea though hence the comment. – Trip Dec 16 '11 at 13:55

1 Answers1

3

I think that you might implement a multistep form(aka wizard) to handle this type of issue.

Ryan Bates did a great tutorial on the subject

Multistep form tutorial

There's probably some gems out there for multistep form

Another solution would be to implement partial validation.You can go to the link below.It's a great blog post about the subject.

Partial validation blog post

Hope it will help to get started.

azoo_b
  • 120
  • 1
  • 9