1

I want to create a Laravel Blade Form with no action. I want to handle all with JavaScript. In HTML I would do:

<form action="#">

or

<form action="javascript:void(0)">

How can I do them in Laravel Blade Form, like this:

{{Form::open()}}

Thank you for your help!

2
  • would it matter try this when you submit the form run the javascript function and at the end use return false; or if you are using jquery use event.preventDefault(); but donot forget to pass the event object i.e the event or whtever you want to name it this prevents the submission of form Commented May 5, 2015 at 12:03
  • Thank you for your suggestion! Now I will use event.preventDefault() and return false every time I use jQuery Ajax in Form, and don't care about the action url in the Form Open! Commented May 8, 2015 at 3:56

2 Answers 2

3

Just do this

{{ Form::open(['url' => '#']) }}
Sign up to request clarification or add additional context in comments.

Comments

0

After all, the form builder just helps you generate a form. You don't have to use it. In your case I'd just write it in plain HTML:

<form action="javascript:void(0)">

To add the csrf token just use:

{{ Form::token() }}

2 Comments

I am afraid that by doing so, we cannot create the _token in laravel blade Form!
The answer is nice! This will help me! Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.