make repeater items when create pade load data from db
hi dev in this case i want create stock opname items automaticly load item from db and loop it in repeater
how can i do that
thx u
29 Replies
share some code you are trying please
i dont know how to auto create repeater field when create page loaded
i saw u in github auto add repeater but it trigger afterstateupdated
now i want auto create when page loaded
->default([['name' => 'Name'],['name' => 'Name2']])
To pre-fill a create form (not edit) on the repeater field would repeat two rows filling name field.
thx bro i already try that way but i stuck on loop from db
i used foreach inside
shema(function(){return []})
i dont how but it rendered only 1 row
oh ya bro
if i want know how to save row to in session
when i clicked simpan draft its row saved into session and if i refresh the page its still there
If it's just that data, you would need to put that into a unique named session on lciking the save. But ensure you clear that when saving the actually form. Ideally you should have a sve as draft global action which saves everything without validation though.
yes i will create a unique session name thx u for that
now how to get all value from that repeater field event empy field
and got null value 😦
$get('../items') ? Assuming the repeater is named items ?
items its repeater it self
You are not making sense
Please provide code snippet as per #❓┊help
ok forget it sorry bro
but default([[]]) it not work in my case
and try this
and got thi
You have not used default correctly, you are missing the enclosed [] it's an array of array'ed data.
Schema should contain each field
If it is a text input, it should have a string, not array..
First, ensure that each input in your foreach loop has a distinct name, and avoid using 'barang' for all of them.
thx u so much brother
God bless you
👍