Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

data recovery with stepper


I work with laravel9 I bought your template with which I work but I have a problem, I created an add form based on your design, which means that I have to fill in the fields step by step, I realized that you use stepper, how do I send the data to my controller?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi Komla,

To send the data from your stepper-based form to your Laravel controller, you can use JavaScript to gather all the form inputs and send them through AJAX. Axios is a JavaScript library for making HTTP requests and can be used for this purpose.

You can refer to this js file for example using stepper.
/resources/_keenthemes/src/js/custom/utilities/modals/create-account.js


Here's a basic example to get all form inputs:


- Create a JavaScript function that gathers the form data and sends it to your Laravel controller via AJAX. Below is a basic example using Axios:


// Assuming you have a button with id "submitBtn" that triggers the form submission
document.getElementById("submitBtn").addEventListener("click", function() {
// Get all form inputs
var formData = new FormData(document.getElementById("yourFormId"));

// Make an AJAX request using Axios
axios.post("/your-controller-endpoint", formData)
.then(function (response) {
// Handle the response if needed
console.log(response);
})
.catch(function (error) {
// Handle errors if any
console.error(error);
});
});


Replace 'yourFormId' with the actual ID of your form, and '/your-controller-endpoint' with the endpoint where you want to handle the form data in your Laravel controller.

- In your Laravel controller, you can handle the form data received from the AJAX request. For example:


public function yourControllerMethod(Request $request)
{
// Access form data using $request
$data = $request->all();

// Process and save the data as needed
// ...

// Return a response if needed
return response()->json(["message" => "Data received successfully"]);
}


Adjust the controller method to fit your application's logic.

Remember to customize the code according to your specific form structure, controller endpoint, and data processing requirements. Additionally, ensure that your Laravel routes and controllers are properly set up to handle the incoming data.


Thank you


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(