Jump to content

The ultimate community for Ruby on Rails developers.


Multi-step form in Rails 4

  • Please log in to reply
1 reply to this topic

#1 gorrillamcd



  • Members
  • 4 posts
  • LocationGuadalajara, Mexico

Posted 09 November 2013 - 05:34 PM

I'm wanting to do an email signup form which, after the user enters their email and submits, a modal pops up asking them to supply more info if they like (for example, first and last name). If they don't enter any info, then the email address still gets submitted, since the other info is not required.


Here's what I'm thinking:


Ajax form for initial email to Lists#subscribe

Javascript triggers modal on success

Ajax form submission for extra details to Lists#edit_subscription


On the server-side, I'm interacting with the mailchimp-api. That's easy. But, I'm no javascript guru and could use some help/pointing in the right direction for the ajax bits. I want it to be that the user isn't redirected to a different page until after the second form.



#2 Jamie



  • Moderators
  • 142 posts
  • LocationNewcastle, UK

Posted 11 November 2013 - 09:35 PM

Hi mate


Welcome to the forums if I haven't said already.


Personally, with your request I would handle this on the Javascript side. I know you said you aren't a guru but what you're after is a modal, or another section of the form that's perhaps hidden that is shown on the successful validation of your other fields.


I'd have a look at Twitter Bootstrap if you wish to use Modals as that'll get you going pretty much straight away.


Have a look online for some simple jQuery validation tutorials and if you get stuck, post your code here and we'll help you out :)

Rails developer based in Newcastle, UK.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users