Actually I want to pass data-parsley-validate as a parameter to form_open() function.
Like <form action="http://recruit.com/controller/add_jobs" accept-charset="utf-8" data-parsley-validate>
Actually, you can init parsleyJS with jQuery:
<form id="form"></form>
<script>
$('#form').parsley();
</script>
So, you dont need to do <form data-parsley-validate></form>
At first load parsley.js in the head of html.
then apply parsley.js in the CI like this:
<form role="form" method="post" id="parsleyForm" data-parsley-validate
action="<?php echo site_url('.........') ?>">
go to this link for details of parsley.js.
Related
I would like to send data with PUT method
However, this error happens.
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The POST method is not supported for this route. Supported methods: PUT.
I don't really understand why my code is not correct.
web.php
Route::get('/', function () {
return redirect('/home');
});
Auth::routes();
Route::put('/save_data', 'AbcController#saveData')->name('save_data');
view.blade.php
<form action="{{route('save_data')}}" method="POST">
#method('PUT')
#csrf
<input type = "hidden" name = "type" value ='stack' >
<div>
<button>post</button>
</div>
</form>
when it is changed
<input type="hidden" name="_method" value="PUT">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
instead of
#method('PUT')
#csrf
It works well.
make sure to check First Another Route with Same Name
You can make POST route and dont need to put this after form tag #method('PUT')
CHange the Placement of the route before this Auth::routes();
use save_data in route instead of /save_data.
use {{url('save_data')}} in action instead of {{route('save_data')}}.
If you insist on using PUT you can change the form action to POST and
add a hidden method_field that has a value PUTand a hidden csrf field
(if you are using blade then you just need to add #csrf_field and {{
method_field('PUT') }}). This way the form would accept the request.
You can simply change the route and form method to POST. It will work
just fine since you are the one defining the route and not using the
resource group
after all this run artisan command
php artisan route:clear
Change:
<button>post</button>
to:
<button type="submit">post</button>
hi i want to change this url from get form
http://127.0.0.1:8000/allfiles?category_id=1&file_id=1
to this in laravel
http://127.0.0.1:8000/allfiles?filter[category_id]=1&filter[file_id]=1
how can i do that?
Actually i want change perquery=? to filter[perquery]=?
thanks
Try something like this in the blade (you can modify it if need):
<form action="http://127.0.0.1:8000/allfiles" method="GET">
<input name="filter['category_id']">
<input name="filter['file_id']">
<input type="submit">
</form>
I'm getting this error after posting the data.
Route;
Route::post('/classified/location', 'ClassifiedController#locationPost')->name('location-post');
Form;
<form class="form" method="post" action="/classified/location">
#csrf
Please check your route file to make sure that you haven't defined the same route twice, in that case later will replace the prior so make sure route definition is unique and exactly once.
Also if you anyway are naming your routes then use the name itself to target it so use:
<form class="form" method="post" action="{{ route('location-post') }}">
Also, make sure you don't define two or more routes with the same name.
Your form tag like that:
<form class="form" method="post" action="{{route('location-post')}}">
OR
<form class="form" method="post" action="{{url('/classified/location')}}">
I have a following form:
<form class="form-horizontal" role="form" method="POST" action="{{ url('/admin/email') }}">
On localhost, it generates https//.... but on server it generates http://... which results in mixed content warning. Is there any flag to fix it ?
<form class="form-horizontal" role="form" method="POST" action="{{ url('/admin/email') }}">
actualy url() accepts three params. string,Array,bool the third params is for secure, means https. you can set it to true.
i hope this helps
If you look at declaration of url method, it's like this
function url($path = null, $parameters = [], $secure = null)
so third parameter is for generating secure URL or not, so your line will be like this
<form class="form-horizontal" role="form" method="POST" action="{{ url('/admin/email', [], true) }}">
I am trying to use laravel with polymer. I have built a form that looks like this
<form action="{{ url('settings/update') }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<h4>Choose your theme</h4>
<paper-radio-group selected="1">
<paper-radio-button name="1" label="Theme Default"></paper-radio-button><br/>
<paper-radio-button name="2" label="Theme Violet"></paper-radio-button><br/>
<paper-radio-button name="3" label="Theme Orange"></paper-radio-button><br/>
</paper-radio-group><br/>
<button type="submit" class="mui-btn mui-btn-primary">Change Theme</button>
</form>
But I have no idea how to retrieve those fields in my controller. Any help would be appreciated.
Form elements don't know how to work with custom elements like paper-radio-button. You could replace your form with ajax-form or use some JavaScript to handle the form submit event, gather up the values, and send the request yourself.