0

I have 2 Controllers Applicants And Applicants_academic_record.

When user click on Continue in Applicants Controller, it takes the user to Create Method of Applicants_academic_record .

When user Clicks on Back Button , it takes user back to Form of Applicants Controller.

I want to perform three tasks.

  1. Continue button should takes the user to other Controller but it should not save the data in Database but it should hold it.
  2. Back button should takes the user back to Applicants Controller and populates the fields with data that users entered earlier.
  3. Create Button at 2nd form should save the data at once. Means data of Current form and also of previous form.

This is my Applicants Form. Applicants Controller

This is my Applicants_Academic_record Form. Academic_Record Controller

Divyang Desai
  • 7,483
  • 13
  • 50
  • 76
Jamshaid Tariq
  • 551
  • 1
  • 8
  • 31
  • 2
    Your 'Continue' button needs to submit the form to a controller method that saves the date to a repository (a separate database table or `Session` etc) and then redirect to the `Create()` method (and pass along a value that identifies the temporary record so it can be retrieved later). But why do you want 2 separate pages? –  Sep 09 '16 at 07:59
  • @StephenMuecke , i am working on **Online Registration** . so i have two Tables in Database with same name as Controllers. Their relationship is `one-to-many`, so i have to separate these forms because one **Applicant** can have multiple **Academic_Records** . – Jamshaid Tariq Sep 09 '16 at 08:05
  • That makes no difference. If your requirement is that you must create one Academic Record when you first create the Applicant, create a view model containing all properties and have one view/form and save everything in one action. –  Sep 09 '16 at 08:12
  • Or better, have one form to create the Applicant and design the view to allow multiple Academic Records to be created (refer [this answer](http://stackoverflow.com/questions/28019793/submit-same-partial-view-called-multiple-times-data-to-controller/28081308#28081308) for an example) –  Sep 09 '16 at 08:14

1 Answers1

0

You need to use jQuery

  1. Continue button: hide the first form and show the second form ( academic details)
  2. Back button: hide the second form and show the first
  3. Save: make ur post action to take two objects the applicant and the academic details

I don't know if the both forms will be submitted , you need to test it.

In case it did not work with you , you can use ajax call

If you need further help, you are welcome to ask

Hope this will help you

Monah
  • 6,714
  • 6
  • 22
  • 52