Jump to content

Different fields in the repeaters


entschleunigung
 Share

Recommended Posts

I have a repeater field with for example four fields: select option, name, phone, email ... Iwant the select option field not to appear in the first repeater, if i clone the repeater field manually, it should appear in the second repeater. I can't get there with the visibility settings, what are the possibilities? maybe a hoook?

If i have to, i can do it with CSS, but i don't want that for now.

Thanks in advance

Link to comment
Share on other sites

@entschleunigung what if the 1st item is moved to another position? Should it still have the select option hidden? Or it should be unhidden as soon as it is not 1st anymore. If the latter is the case, it seems like there is no built-in solution (but you can inject your own js and still do it). But if you're looking for the former, there are probably some ways to implement it.

Link to comment
Share on other sites

hi @Ivan Gretsky,

the first repeater always remains the first, the order does not change.
in the repeater (they are created with a hook) are time entries and can be duplicated by the editors in the backend, for further editing some fields are necessary, which i don't need in the first repeater.

@BitPoet, as far as I understand FieldsetPage doesn't help me at this point, right?


thanks a lot so far

Link to comment
Share on other sites

8 hours ago, entschleunigung said:

the first repeater always remains the first, the order does not change.

As far as I got it, it is just by convention. Nothing prevents someone to move the 1st item to another position. That was what I was asking about.

In this case just maybe you can move the fields that should hold the data for the 1st item to the main template (maybe group them in a fieldset for convenience). Or do as @BitPoetwrote and move those fields to a FieldsetPage field instead.  And only use repeater items for other entries that are all the same? Not what you've been asking for, but still an option.

  • Like 1
Link to comment
Share on other sites

10 hours ago, entschleunigung said:

as far as I understand FieldsetPage doesn't help me at this point, right?

I'm not completely sure, but the hook could easily copy values from the FieldsetPage to a new repeater item if that is needed. The field names will be identical, so it'll just be a loop like

foreach(['name','phone','email',...] as $fieldname) {
	$newItem->$fieldname = $page->myFieldsetPage->$fieldname;
}

 

  • Like 1
Link to comment
Share on other sites

17 hours ago, Ivan Gretsky said:

As far as I got it, it is just by convention. Nothing prevents someone to move the 1st item to another position. That was what I was asking about.

As far as I understand, this is just a convention. Nothing prevents someone from moving the 1st point to a different location. That was what I wanted to know.

That's true, but in this use case I can live with it since it's a small group of users that will be working with it. They know about it and they know the process.

The first entry, i.e. the first repeater always exists, under certain circumstances it may be that this first entry has to be corrected, and there it seemed easiest to me to solve this via repeater, that it already offers the possibility to clone the repeater manually by an editor in the backend.

i have now solved it with a few lines of jQuery.

best thanks so far

 

 

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...