Home Forums Add-ons Repeater Field Empty Group have_rows is true? Reply To: Empty Group have_rows is true?

  • I think that it’s intended.

    If the post has never been saved then the group has no rows but if it has been saved it will always have one row even if all the fields in the group have no value.

    I think that using have_rows() is just a convenience so that you can reference the fields without the group field name prefix.

    For example, lets say that you have a group field with the name of “group” and it has 2 sub fields; “field_1” and “field_2”.

    You can access these fields like this:


    or for the convenience of not added the field names together you can do:

    while (have_rows('group')) {

    have_rows() will always return true if the post has been saved.

    Think of a regular repeater that has several sub fields but none of them are required. If you add a row to this repeater but do not enter any values into it the empty fields will be saved. This repeater will have one row even though no values have been entered into the existing row. The group field works the same way.

    If you think this is a bug you are free to open a new support ticket