[object Object] shows as default in Repeater->simple(TextInput)
Hi, I have text into my input by default but I don't understand why ...
14 Replies
Can you share some code?
I've seen that when I create a Form Select field with
But if I'm doing something more complex like the following, I get the
native(false)
set and a complex options()
query.
Like, this works fine:
native(false)->options(Model::all()->pluck('name', 'id'))
But if I'm doing something more complex like the following, I get the
[object Object]
output you mentioned:
(in this case the 'name_description'
is actually a custom Attribute on my model, which concatenates the two fields with a <br> tag ... not super complex, but it's a custom Attribute, and not a direct model property)
Hopefully that gives you an idea where to explore what your problem's root is.
But like Matthew said, it's always easier to help if you provide the code that's causing it. πWell the code is really not that complex, its just a section into a Wizard step. I'm writing it in the CreateFoo page of my Foo resource. Tell me if you want to see a specific part, but honestly its just when I use the simple() method on my repeater ...
This code is into getSteps(), from the HasWizard trait
Its probably better than an image
Ya, I get the same with a non-wizard form:
I'm not sure if it's something that is cascading from the
simple-repeater.blade.php
template into the $item
slot where text-input.blade.php
is rendered, or if it's just something inside the text-input.blade.php file itself.
Or might be elsewhere altogether.
But it seems to only happen with ->simple()
.
Maybe should update the Title of this post to something like "[object Object] shows as default in Repeater->simple(TextInput)" ?
Seems to only happen if there's no dataset. If you add a ->default(['foo'])
array, it's fine.Yes, its better
It doesnt work for me even with a default π¦
Default only works on create not edit
Its into a Wizard for resource creation, in a CreateRecord class
Is your livewire and filementphp fully up to date? There was a big a few versions back for the object, object.
Well yes, I think
I've a composer update recently in order to fix this bug
and also because I couldn't use simple() on my repeater (my version of filament was too old) ...
But now, I don't know what else I can do to fix this problem
try:
->options( fn() => Model::all()->pluck('name_description', 'id'))
failing that try:
->options( fn() => Model::where('id' , '=>', 0)->pluck('name_description', 'id'))
Options ? On my Repeater ?