Comments (29)
@tanthammar everything is working now and v2 is looking fantastic! This issue can be closed.
from tall-forms.
Can you please post your component code.
from tall-forms.
<?php
namespace App\Http\Livewire\Shop;
use App\Models\Tenant\Shop;
use Livewire\Component;
use Tanthammar\TallForms\Input;
use Tanthammar\TallForms\TallForm;
class ShopForm extends Component
{
use TallForm;
/**
*
* @return void
*/
public function mount(?Shop $model)
{
$this->fill([
'formTitle' => null,
'showGoBack' => true,
'wrapWithView' => false,
'onKeyDownEnter' => '',
'inline' => false,
]);
$this->mount_form($model);
}
/**
*
* @return array
*/
public function fields()
{
return [
Input::make('Name')
->rules(
$this->model->exists ? 'required|unique:shops,name' : 'required|unique:shops,name,' . $this->model->id
),
];
}
}
from tall-forms.
@BTW: I had to set onKeyDownEnter
this way, otherwise there will be also an error:
Argument 1 passed to Tanthammar\TallForms\Components\Form::__construct() must be of the type string, null given
Removing won't work.
from tall-forms.
Thank you for letting me know about onKeyDownEnter
, i released a fix for it.
Regarding your code example, I am unable to reproduce your error.
- Do you have any published views from v3 that might cause the conflict?
- Do you have any published config from v3?
- Can it be the model binding? Should it be (?Shop $shop)?
I do not have the Shop class so I did like this and it is working with and without model.
Route::get('/issue-test/{user?}', \App\Http\Livewire\App\IssueTestForm::class);
<?php
namespace App\Http\Livewire\App;
use App\User;
use Livewire\Component;
use Tanthammar\TallForms\Input;
use Tanthammar\TallForms\TallForm;
class IssueTestForm extends Component
{
use TallForm;
/**
*
* @param User|null $user
* @return void
*/
public function mount(?User $user)
{
$this->fill([
'formTitle' => null,
'showGoBack' => true,
'wrapWithView' => false,
'inline' => false,
]);
$this->mount_form($user);
}
/**
*
* @return array
*/
public function fields()
{
return [
Input::make('Name')
->rules(
$this->model->exists ? 'required|unique:shops,name' : 'required|unique:shops,name,' . $this->model->id
),
];
}
}
from tall-forms.
I also tried to place the component in a view
<livewire:app.issue-test-form :user="\App\User::first()" />
from tall-forms.
Thank you for the fix!
Do you have any published views from v3 that might cause the conflict?
No. Removed everything to start from scratch.
Do you have any published config from v3?
No. Removed old config and published the new one.
Can it be the model binding? Should it be (?Shop $shop)?
Model binding looks like this:
<livewire:shop.edit-form :shop="$shop" />
and componentent updated to this:
public function mount(?Shop $shop)
{
$this->fill([
'formTitle' => null,
'showGoBack' => true,
'wrapWithView' => false,
'inline' => false,
]);
$this->mount_form($shop);
}
The error also occurs on create.
from tall-forms.
Also tested with \App\User. I'm still getting this error. Really strange.
from tall-forms.
Maybe it helps to find the problem, the Select
field also throws an error:
Undefined variable: options (View: vendor/tanthammar/tall-forms/resources/views/components/select.blade.php)
from tall-forms.
Laravel 7?
from tall-forms.
yes
from tall-forms.
Is the component wrapped with another component or view?
from tall-forms.
Is the component wrapped with another component or view?
No.
@extends('layouts.tenant', ['title' => 'Shops'])
@section('content')
<div>
<div class="shadow overflow-hidden sm:rounded-md">
<div class="px-4 py-5 bg-white sm:p-6">
<livewire:shop.edit-form :shop="$shop" />
</div>
</div>
</div>
@endsection
from tall-forms.
So you have an almost blank app.blade.php and the form?
from tall-forms.
Do you have the Livewire v2 required {{ $slot }} somewhere?
@extends('layouts.base')
@section('body')
@yield('content')
{{$slot ?? null}}
@endsection
from tall-forms.
Do you have the Livewire v2 required {{ $slot }} somewhere?
@extends('layouts.base') @section('body') @yield('content') {{$slot ?? null}} @endsection
No, that was missing. But has no effect.
from tall-forms.
From the livewire docs
<!-- Before -->
<html>
<body>
@yield('content')
@livewireScripts
</body>
</html>
<!-- After -->
<html>
<body>
{{ $slot }}
@livewireScripts
</body>
</html>
from tall-forms.
Yes, I've updated this. Also have
<!-- Blade UI Kit Scripts -->
@bukScripts
from tall-forms.
@tanthammar Checkboxes are working as expected.
from tall-forms.
I will have to up a new project. But I don't have the time now. Will get back to you in a an hour or two.
Have no issues in my local repo.
from tall-forms.
Now I have tested this with a fresh installation of Laravel 7, and while I was at it, I also tested Laravel 8 Jetstream.
I had no issues like you are describing.
Sorry.
from tall-forms.
@danielbehrendt Have you gotten any further with this? Didn't hear back from you yesterday. Would really like to know where this is coming from.
from tall-forms.
@tanthammar This is really strange. Yesterday I've setup a fresh Laravel (going up to v8) and installed all my required packages. Now I've got it running but I do have some other side effect (also with Livewire). I'll have to do so some more debugging, and I'll share any new insights here.
from tall-forms.
@danielbehrendt Thank you for letting me know. Looking forward to your feedback.
from tall-forms.
@danielbehrendt just a thought:
Could you new up a project using Laravel 8 Jetstream, --stack Livewire, no --teams?
Don't install any of your components.
Do you still have issues?
That is what I did when testing yesterday.
Which packages are you using? Maybe there is a Livewire conflict with them?
Are you using the latest AlpineJS version?
Any errors in console?
from tall-forms.
@tanthammar That's really strange. Now that I have a fresh stack (without Jetstream) everything works fine.
One thing I've noticed (already in Livewire v1) is that multiple checkboxes are not getting checked correctly if they were clicked quickly one after the other. Do you have this problem too?
from tall-forms.
Checkboxes: That is due to the network request.
Set ->wire('wire:model.defer) You'll loose out on real-time validation but the problem is gone. The field will be validated on submit.
This issue: All is working for you now? Can this issue be closed?
from tall-forms.
@danielbehrendt Did you ever find out what was wrong with your installation, that broke Livewire and this package?
from tall-forms.
@tanthammar No, unfortunately (or luckily) not. I'm not able to reproduce the errors.
from tall-forms.
Related Issues (20)
- Translations not working HOT 4
- placeholder is not defined on Checkboxes HOT 2
- livewireValue is not defined HOT 7
- how to store data in a json column? HOT 1
- Notifications from session are empty HOT 4
- Dots in Validation error message are stripped HOT 6
- "views/components/pages/default.blade.php" not created HOT 2
- form-select HOT 3
- Undefined variable $form HOT 2
- setting disabled() doesn't apply default form styles
- fieldWith does not have any effect HOT 2
- Missing clear example in Documentation HOT 1
- When view:cache, Unable to locate a class or view for component [pages.default] HOT 6
- ABORTING: This installer only supports Laravel >= v8 HOT 2
- Version for new Livewire HOT 4
- With Radio field can´t get value in form_data HOT 6
- Require php ^7.4.4 -> your php version (8.2.12) does not satisfy that requirement. HOT 1
- FileUpload with Repeater HOT 2
- Sponsor access? HOT 2
- Module not found: Error: Can't resolve '@alpinejs/trap' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tall-forms.