GithubHelp home page GithubHelp logo

Comments (29)

danielbehrendt avatar danielbehrendt commented on July 21, 2024 1

@tanthammar everything is working now and v2 is looking fantastic! This issue can be closed.

from tall-forms.

tanthammar avatar tanthammar commented on July 21, 2024

Can you please post your component code.

from tall-forms.

danielbehrendt avatar danielbehrendt commented on July 21, 2024
<?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.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

@BTW: I had to set onKeyDownEnterthis 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.

tanthammar avatar tanthammar commented on July 21, 2024

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.

tanthammar avatar tanthammar commented on July 21, 2024

I also tried to place the component in a view

<livewire:app.issue-test-form :user="\App\User::first()" />

from tall-forms.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

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.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

Also tested with \App\User. I'm still getting this error. Really strange.

from tall-forms.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

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.

tanthammar avatar tanthammar commented on July 21, 2024

Laravel 7?

from tall-forms.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

yes

from tall-forms.

tanthammar avatar tanthammar commented on July 21, 2024

Is the component wrapped with another component or view?

from tall-forms.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

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.

tanthammar avatar tanthammar commented on July 21, 2024

So you have an almost blank app.blade.php and the form?

from tall-forms.

tanthammar avatar tanthammar commented on July 21, 2024

Do you have the Livewire v2 required {{ $slot }} somewhere?

@extends('layouts.base')
@section('body')
    @yield('content')
    {{$slot ?? null}}
@endsection

from tall-forms.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

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.

tanthammar avatar tanthammar commented on July 21, 2024

From the livewire docs

<!-- Before -->
<html>
    <body>
        @yield('content')

        @livewireScripts
    </body>
</html>

<!-- After -->
<html>
    <body>
        {{ $slot }}

        @livewireScripts
    </body>
</html>

from tall-forms.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

Yes, I've updated this. Also have

<!-- Blade UI Kit Scripts -->
@bukScripts

from tall-forms.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

@tanthammar Checkboxes are working as expected.

from tall-forms.

tanthammar avatar tanthammar commented on July 21, 2024

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.

tanthammar avatar tanthammar commented on July 21, 2024

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.

tanthammar avatar tanthammar commented on July 21, 2024

@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.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

@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.

tanthammar avatar tanthammar commented on July 21, 2024

@danielbehrendt Thank you for letting me know. Looking forward to your feedback.

from tall-forms.

tanthammar avatar tanthammar commented on July 21, 2024

@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.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

@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.

tanthammar avatar tanthammar commented on July 21, 2024

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.

tanthammar avatar tanthammar commented on July 21, 2024

@danielbehrendt Did you ever find out what was wrong with your installation, that broke Livewire and this package?

from tall-forms.

danielbehrendt avatar danielbehrendt commented on July 21, 2024

@tanthammar No, unfortunately (or luckily) not. I'm not able to reproduce the errors.

from tall-forms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.