I am using Laravel blade, I am facing problem that am not able to get the input name for dropzone area to save to the database in dropzone.js. So I need to set name for dropzone area which must be type array.
Below is my code.
{!!Form::model(null,array('url'=>'/assets/global/plugins/dropzone/upload.php','class'=> 'dropzone dropzone-file-area', 'id'=> 'my-dropzone','files'=>'true','style'=>"width: 100%;height:50px;")) !!}
<h3 class="sbold">**Drop files here or click to upload**</h3>
{!! Form::close() !!}
Remove 'id'=> 'my-dropzone' from Form::model() and put it in div inside the form:
<div id="my-dropzone"></div>
Related
So I'm using Livewire 2.10.4 and I have a textarea within a modal, which looks like this:
<div
x-data="{
showDiscontinueModal: #entangle('showModal')
}"
>
<x-modal x-model="showDiscontinueModal" modalDialogClasses="modal-sm-md">
<x-slot name="content">
<x-input.group class="w-full">
<x-input.label>{{ trans('rx.pharmacy_notes') }}</x-input.label>
<x-input.textarea
wire:model="pharmacyNote"
/>
</x-input.group>
</x-slot>
</x-modal>
</div>
The textarea blade component looks like this:
#aware(['error'])
#props(['error' => null])
<textarea
type="text"
x-bind:id="$id('input')"
{{ $attributes->class([
'form-input',
'form-control',
'missing' => $error,
]) }}
></textarea>
But each time the user types something in the textarea input field Livewire hydrates, causing a lot of unnecessary requests and weird behavior in the input (it flickers and erases part of what's being typed)
So far I tried to use wire:model.defer , wire:model.lazy and wire:model.debounce to try to mitigate the number of requests but for some reason this is not affecting the behavior at all. I also tested changing the field to a simple text input and that didn't work either.
try wire:ignore or wire:ignore.self for your textarea parent
Good day to all, I am beginner in Laravel and as you know html form by default sends POST requests and wanted to ask if it is ok if I omit POST at the beginning of form tag since I want to send POST request to server The code:
{!! Form::open(['method' => 'ToDoController#store' **I am not specifying type of request**]) !!}
<div class="form-group">
{{Form::label('text', 'Text', ['class' => 'awesome'])}}
{{Form::text('text', '', ['class'=>'form-control' ,'style'=>'width:200px'])}}
</div>
<div class="form-group">
{{Form::label('text', 'Text', ['class' => 'awesome'])}}
{{Form::text('text', '', ['class'=>'form-control' ,'style'=>'width:200px'])}}
</div>
{{Form::submit('Submit')}}
{!! Form::close() !!}
It is OK to omit an attribute if the default is what you intend to carry out. However, you should note the following.
HTML forms by default sends 'GET' requests.
Form Collective which is a package used in Laravel Framework has by default set the method attribute of HTML forms to 'POST'.
So, the reason why your form is sending a 'POST' even when you didn't set the method attribute is because you are using Form Collective else your form would have defaulted to 'GET'.
Meanwhile, from the snippet you pasted:
{!! Form::open(['method' => 'ToDoController#store' **I am not specifying type of request**]) !!}
Change that to:
{!! Form::open(['action' => 'ToDoController#store']) !!}
The method attribute is meant for specifying the kind of request...chiefly 'GET' or 'POST' while the action attribute is meant for specifying the Controller action that will handle the request.
Please help me to change text "Choose File "on file type input button???
If possible, how do I change its shape ???
I am coding on laravel blade using BootForm.
{!! BootForm::file('Upload File', 'upload_file')->helpBlock('Please upload a file to verify your submit.') !!}
Don't think about changing choose file
just hide choose file and change the label for that file input, this code may help you
{!! Form::label('upload_file', 'UPLOAD',['class'=>'btn btn-md btn-primary']) !!}
{!! Form::file('upload_file',['style'=>'visibility:hidden']) !!}
I want to create a ref link like this in laravel 5.4Registration form
emails example.com
For every registered user and when the link is click it should redirect to the registration form where the ref value is automatically get into the REF form field as given in the image. Here are the related images RegistrationController
Edit : Updated the link generation based on comments
Generate the referral link using the logged in user's email. Assuming you have the logged in user as $user, if not replace it with auth()->user()->email. Note that this will need logged in user's email. So it goes without saying that you need to be logged in before to generate the ref link.
If you pass the currently logged in user to your view from controller then do this, where $user = auth()->user();
Referral register link
If you want to directly access the logged in user's email
Referral register link
This is how it would look like in the view.
Referral register link
Add the following code in your registration form depending on how you create the form.
<input type="text" name="referrer" value="{{ request('ref') }}">
Or
{!! Form::text('referrer', request('ref')) !!}
The idea like this: In the email make a link like this:
Register
In your form, you can add hidden or disabled textbox like this:
<input type="textbox" name="ref" value="{{ request()->get('ref') }}"/>
You could also add it to the session object in your controller like this:
function create(Request $request) {
return view('register')->with(['ref' => $request->query('ref')]);
}
And populate your form with {!! Former::populate(['ref' => $ref]) !!} if you're using Former or use form model binding (see here)
Example form markup in register.blade.php with Former:
{!!Former::horizontal_open()
->method('POST') !!}
{!! Former::populate(['ref' => $ref]) !!}
{!! Former::text('ref') !!}
...
{!! Former::actions()
->large_primary_submit('Create') # Combine Bootstrap directives like "lg and btn-primary"
->large_inverse_reset('Reset') !!}
{!!Former::close() !!}
In Symfony docs they say to use this
<div>
{{ form_label(form.task) }}
{{ form_errors(form.task) }}
{{ form_widget(form.task) }}
</div>
But this generates the label element.
But I want to have table <td> instead of <label>
And also for the input textbox, I want to mention the size of text box. Where can I do that?
You have to define your form theme.
Probably, this tutorial is what you are looking for