0

I have a form and I want to make a submit button that submits the form but ALSO shows a new(blank) instance of the same form. How can I accomplish this? I am using the wicked gem to make steps and I thought I could do this...

<%= link_to 'Add Another Tenant', wizard_path(:same_step_that_im_already_on), class: "btn btn-info btn-lg"%>

but it is not working.

SupremeA
  • 1,519
  • 3
  • 26
  • 43
  • what do you mean by shows a new instance? – Anand Dec 13 '17 at 05:09
  • Couldn’t you have the post / put action redirect to the new path (passing a new object of course)? This would happen if the first created object was created successfully. – inveterateliterate Dec 13 '17 at 05:42
  • I didn't understand what exactly did you mean, but maybe, if you need to show saved record on page where you submit form, then you can use ajax. Send with ajax form data to controller and render js for showing saved record. – Dima I. Belinski Dec 13 '17 at 08:08
  • No, this button is if they need to add multiple invitations I want the button to submit the current form instance that is filled out and show a new blank instance. – SupremeA Dec 13 '17 at 14:39
  • I think you can use ajax (on submit) to save record and reload part of the page when you have form to show form for new record. – sbulat Dec 13 '17 at 15:17

0 Answers0