diff --git a/app/Http/Controllers/FormController.php b/app/Http/Controllers/FormController.php index 32f1d7f..2f51fcb 100644 --- a/app/Http/Controllers/FormController.php +++ b/app/Http/Controllers/FormController.php @@ -12,4 +12,9 @@ class FormController extends Controller return view('dashboard.administration.forms'); } + public function saveForm(Request $request) + { + dd($request->all()); + } + } diff --git a/public/js/formbuilder.js b/public/js/formbuilder.js index a9daa91..bde6b88 100644 --- a/public/js/formbuilder.js +++ b/public/js/formbuilder.js @@ -4,8 +4,8 @@ $(document).ready(function() { var intId = (lastField && lastField.length && lastField.data("idx") + 1) || 1; var fieldWrapper = $("
"); fieldWrapper.data("idx", intId); - var fName = $(""); - var fType = $(""); + var fName = $(""); + var fType = $(""); var removeButton = $(""); removeButton.click(function() { $(this).parent().remove(); @@ -16,3 +16,7 @@ $(document).ready(function() { $("#buildyourform").append(fieldWrapper); }); }); + +function save() { + document.getElementById('formbuilder').submit(); +} diff --git a/resources/views/dashboard/administration/forms.blade.php b/resources/views/dashboard/administration/forms.blade.php index 0ae9c46..e3f323e 100644 --- a/resources/views/dashboard/administration/forms.blade.php +++ b/resources/views/dashboard/administration/forms.blade.php @@ -18,9 +18,15 @@
-
- Form Builder -
+
+ + @csrf + +
+ Form Builder +
+ +
@@ -31,7 +37,7 @@ diff --git a/routes/web.php b/routes/web.php index 0495da1..816dde0 100644 --- a/routes/web.php +++ b/routes/web.php @@ -67,7 +67,11 @@ Route::group(['middleware' => 'auth'], function(){ Route::resource('positions', 'VacancyController'); - Route::resource('forms', 'FormController'); + Route::get('forms', 'FormController@index') + ->name('showFormBuilder'); + + Route::post('forms/save', 'FormController@saveForm') + ->name('saveForm'); });