We can send the values of text as follows in laravel collectives? Is it possible to send the value of a button in laravel collecctives?
{{Form::text('element_id','',['class'=>'form-control'])}}
May the following will do the trick
{{ Form::button('Delete', array('class' => 'btn btn-danger delete', 'type' => 'button', 'value' => 'the value')) }}
Related
I want a way to create popup form when I press the button using Ajax and bootstrap
and how to create modal for it with bootstrap
use yii\bootstrap\Modal;
you can do it like it, call a view/action in modal
<?php
Modal::begin([
'toggleButton' => [
'label' => '<i class="fa fa-plus"></i> Add',
'class' => 'btn btn-success'
],
'closeButton' => [
'label' => 'Close',
'class' => 'btn btn-danger btn-sm pull-right',
],
'size' => 'modal-lg',
]);
$myModel = new \frontend\models\SomeModel;
echo $this->render('/someview/create', ['model' => $myModel]);
Modal::end();
?>
reference Render Form in popup via AJAX
I have from:
{{ Form::open(array('url' => 'announcements', 'class' => 'form-inline', 'method' => 'GET')) }}
And checkbox in form:
{{Form::checkbox('only_subscriptions', '1', old('only_subscriptions'))}}
After submit I get empty old():
old('only_subscriptions')
You would use ->withInput() in redirect(), not in view().
I want to show multiple selected values in laravel5.3 form
{!! Form::select('category[]', $categories['all_cat']['categories'], null,['multiple' => 'multiple'], ['class' => 'form-control', 'id' => 'category']) !!}
Try with this:
{!! Form::select('category[]', $categories['all_cat']['categories'], null, ['multiple' => true, 'class' => 'form-control', 'id' => 'category']) !!}
Below is my submit button code.
{!! Form::submit('Update', array('class'=>'btn btn-primary','style'=>'width: 200px')) !!}
I want to change that by adding onclick event as below.
onclick="if( ! confirm('Are you sure you want to delete?')){return false;}">
How to code that in laravel?
If you're not using the jQuery then you can add it to array like:
{!! Form::submit('Update', array(
'class' => 'btn btn-primary',
'style' => 'width: 200px',
'onclick' => "if( ! confirm('Are you sure you want to delete?')){return false;}"
)) !!}
I'm trying to get the font awesome icon to show in my delete button in my laravel form.
Here is the delete button
{{ Form::submit('<i class="fa fa-pencil"></i> Delete', array('class' => 'btn btn-danger', 'role' => 'button')) }}
{{Form::button(' Se connecter<i class="fa fa-key icon-on-right"></i>', array(
'type' => 'submit',
'class'=> 'pull-right btn btn-primary',
))}}
When you use Form::submit, the content is always escaped. You can use Form::button instead, which does not escape the content.
Your code can be tweaked to:
{{ Form::button('<i class="fa fa-pencil"></i> Delete', ['class' => 'btn btn-danger', 'role' => 'button', 'type' => 'submit']) }}
Also make sure to set type = submit while using Form::button.
Check out my previous answer.
Basicly laravel allows to decode any html with {{HTML::decode(<insert Form button here>) }}
Unfortunately the form builder is always going to escape it's content. Furthermore, the submit input type only supports text content, not HTML. You need to use a button element to display HTML content.
<button class="btn btn-danger"><i class="fa fa-pencil"></i> Delete</button>