lazy-blocks icon indicating copy to clipboard operation
lazy-blocks copied to clipboard

Initial rendered value with repeater

Open mainpart opened this issue 5 years ago • 4 comments

Insertion of repeater row does not pass to server render initialy selected value of select box

image

dump of xhr request event (to /wp-json/lazy-blocks/v1/block-render) shows that 3rd row content is empty

image

mainpart avatar Feb 18 '20 11:02 mainpart

Unfortunately, default values of repeater items are not supported at all. image

nk-o avatar Feb 26 '20 12:02 nk-o

Not sure if it is about default value. I'm not using it.

It's about first value. My select contains some items so when i'm inserting row it inserts select with the first value selected automaticaly. It's not null, not empty and it's not default.

It's just first value in pre-defined select block and it pass to server as empty.

mainpart avatar Feb 27 '20 03:02 mainpart

You added options to select field, but it doesn't mean, that it has a default value by default. It just displayed the first available option in the select field, nothing special.

I recommend you enable this setting for now:

image

It will add this new option:

image

But I see another bug :) It will save the value '-- Select --' when you manually select this first value... It will be fixed soon :)

nk-o avatar Feb 27 '20 09:02 nk-o

Hi guys!

I have a mandatory select field where I want to require the user to select one of the values, but I can't do it, if I use a field with Allow null, then the field can be left at Select and it will be valid, which is wrong for me, if I use a field without Allow null, then the field will automatically set the first value from the list to label, in the second case is fun - if I need the first value and it is visible that it is set to field, then it is still not valid until I manually expand the list and select it

I think this problem could be solved by default field support, which unfortunately is not supported yet :(

Thanks for the lazy blocks! :rocket:

https://user-images.githubusercontent.com/17677196/141504862-03f98a5e-c460-470c-92c9-33b289b08152.mp4

andrewgolovanov avatar Nov 12 '21 15:11 andrewgolovanov

In the v3 we added support for default control values inside the repeater. Defaults are inserted automatically once you add the row.

nk-o avatar Nov 13 '22 16:11 nk-o