[object Object] shows as default in Repeater->simple(TextInput)
Hi, like the title say ... I have no idea why its doing that. Its a repeater->simple() which is into a getSteps() method, into a Create{ResourceName} class (extends CreatedRecord)
Help would be really appreciated ๐
48 Replies
I feel like you are using it wrong:
It can't be used for creating a resource ?
Like I need to have a relationship filling the Repeater ?
You don't have to use relationship
The repeater component allows you to output a JSON array of repeated form components.
We recommend that you store repeater data with a JSON column in your database. Additionally, if you're using Eloquent, make sure that column has an array cast.
Ok, so I'm not using it wrong
Maybe you need to cast the column to JSON or something
๐ค
I have a SheetResource, which can have a json array of objectives. So in the SheetResource creation form I have this Repeater->simple() which take one objective by line.
Show code
For visualizing where is this Repeater, I have described it in the post description
Remove the cast
try again
Same ...
And also, the context doesn't matter here, since I have the same problem anywhere I put a Repeater->simple()
Let me try
Ok
Test data
Just works ๐
Check in create, not edit.. In edit working fine, in create it shows like OP
ooh
You are right
Creating works too?
But if you dont have
->defaultItems(0)
it shows Object object indeed. ๐คYes this one prevent this error tho.. so @Chriis you can put "defaultItems" for time being.. haha
Thats what i said
Yeah it works, but I thought we could have an empty input ๐ฆ
But no problem I'm going to use this
I don't think it can ever be empty.
Make sure to make a bug report if there is not one already.
Well if not it should be clearly displayed in the documentation
Because its confusing
You can actually, my bad.
Just not for relationships i think ๐
I'll check and if I can fix I'll create a PR and inform here again
Ok thx a lot
GitHub
Simple repeater [Object Object] fix by valpuia ยท Pull Request #8845...
Changes have been thoroughly tested to not break existing functionality.
New functionality has been documented or existing documentation has been updated to reflect changes.
Visual changes are ex...
Nice, but what happened to the PR ?
It has been closed for your remark on the documentation but you did actually fixed the "[Object Object]" bug in it right ?
Not sure why its closed
I think its because he also talk about the output of the repeater->simple() which is not like described in the documentation, and Dan is right about this. However, Dan missed the main topic of the PR which is the bugfix for "[Object Object]" and not the documentation "problem" ... ๐
Maybe you can ping him ๐
@Dan Harrin
Or respond to the Ticket.
Theres not enough detail, i dont know what the problem is
what does the data in the database look like
If you have a json column named examples and you just follow the docs:
When creating a new resource with that field it will show
Object object
See my example
Im not sure what causes this but i tried to replicate hes issue and i got the same ๐so the issue is only to do with default() ?
and its not an issue with data in the database being loaded back into the form
Only when creating i would say.
Yea
well when creating, it saves into the database correctly
so its a problem with default
Yea yea thats what i meant.
and this is why i closed it, that detail was not mentioned anywhere
I see
Im not sure what VP mentioned and if he actually fixed it.
well that code affects both defaults and Edit
so i will need to test it myself
Alrighty ๐
Let me know if you need any more info ๐
Will try to look more..
Is there a fix yet? For the meantime set ->default([""]) (array with an empty element)
Idk if @Vp had time to look more into it, I'm also waiting for it ๐ฆ
Sorry guys, i cannot figure out the root problem, i just submitted an issue https://github.com/filamentphp/filament/issues/8874
This is another trick instead of default item 0
GitHub
[object Object] display on simple repeater ยท Issue #8874 ยท filament...
Package filament/filament Package Version 3.0.67 Laravel Version 10.26.2 Livewire Version 3.0.5 PHP Version 8.2 Problem description While using below code, it shows [object Object] in input field w...