Laravel 5 - Handling multiple forms on a single page -


i have page select option

<div class="col-md-7">     <select class="selection" name="selection">         <option value="ab">form one</option>         <option value="ad">form two</option>         <option value="nq">form three</option>     </select> </div>  <div id="content"></div> 

for jquery, listen change

$(".selection").on("change", function(e){     if($(this).val() == "ad"){         $("#content").append(data);     } }); 

now blade template lives (resources/views/customer), have created forms folder. in folder form1.blade.php , 2 more templates other forms.

how go added form template div id content?

or there better way of handling multiple forms single page?

thanks

suppose, have 2 forms this:

view :

<form action="/url" method="post">     <input name="some_field" value="1">     <button type="submit" name="form1">submit 1</button> </form> <form action="/url" method="post">     <input name="some_field" value="1">     <button type="submit" name="form2">submit 2</button> </form> 

now in controller :

if ($request->has('form1') {     //handle form1 }  if ($request->has('form2') {     //handle form2 } 

source: https://laracasts.com/discuss/channels/laravel/two-form-on-one-page-both-submit


Comments