Submitting Multiple Forms with a Single Button

2 posts, 0 answers
  1. Joel
    Joel avatar
    5 posts
    Member since:
    Jan 2019

    Posted 14 Feb 2019 Link to this post

    As the title states, is it possible to submit multiple partial views with a single button? Open to using javascript, jquery, ajax. 

    I have them coming from the same model, but there are two partial views with separate forms, I am wondering if there is anyway to submit it with just using a single click?

    Thanks

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5359 posts

    Posted 18 Feb 2019 Link to this post

    Hello Joel,

    I can suggest two relatively easy approaches to this:

    • If possible, wrap both partials in one single form so any <input type="submit" /> will POST all the inputs from both partial views
    • Alternatively, use something like document.getElementById("firstForm").submit(); and document.getElementById("secondForm").submit(); on the client-side click of a <button>. Of course, there are many ways to get the references to the <form> elements, this is up to the structure and logic you have.

     


    Regards,
    Marin Bratanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top