Jump to content

Recommended Posts

Posted

Hi!

I have been using processwire for some time now, but I never needed repeaters until a few months back.
My client wanted an event page that should list all upcoming events, so I set it up with a date picker and a text and link field.
I set the element label to {myDateTimeField} : {myLinkText}
and it worked. In the end he never needed it and we never turned it on.
Now he need something similar and I setup a template with a new repeater field that holds the needed fields, but now I have several problems that I cannot solve.

  1. the date is not saved if i don't include a time
  2. the date is not shown in the label as mentioned above.
  3. the old template that used to work, does not work with new entries

I simply don't know how to debug this problem.

Thank you for any hints that lead me in the right direction!

Posted

I think more input is required to provide help. ?

  • Do you enter the date via API or in backend? How did you define date and time input formats for your date field?
  • If the date is not shown in the label (for an item holding a proper date value), double check if names are identical (field and in label definition)
  • Does the "old template" now produce an error or simply does not show the date (check the name in that case)?
Posted
17 hours ago, Autofahrn said:

I think more input is required to provide help. ?

  • Do you enter the date via API or in backend? How did you define date and time input formats for your date field?
  • If the date is not shown in the label (for an item holding a proper date value), double check if names are identical (field and in label definition)
  • Does the "old template" now produce an error or simply does not show the date (check the name in that case)?

Well... thanks for asking about the date format. I know I had set it and even tried several versions, but today it was not set. I checked multiple times yesterday, trying to figure out what's wrong...
After setting the formats to a value I like, it now all works flawlessly - in the old and the new repeater! ?

Is there a way to sort the repeater elements by a field (date)?
 

 

Thank you!
I feel kinda dumb now...
?
 

  • Like 1
Posted
14 minutes ago, rsi said:

Is there a way to sort the repeater elements by a field (date)?

Sadly no, at least not in admin or to my knowledge. If you like to have it sorted, think about using a PageTable instead. Probably not as comfortable as the repeater for this purpose.

  • Like 1
Posted
7 hours ago, rsi said:

Is there a way to sort the repeater elements by a field (date)?

@Robin S has already provided us with hundrends of goodies, one of them this deals with it:

Quote

It's not a perfect solution because users can still drag repeater items up and down - the forced sort is only shown after page save.

https://github.com/processwire/processwire-issues/issues/70#issuecomment-258023285
same in the forum:
https://processwire.com/talk/topic/1674-sorting-repeater/?do=findComment&comment=131713

 

  • Like 5
Posted

Thank you! I might give it a try. It would be really helpful, the way I believe repeaters are meant to be used, if we could sort them by fields, or set new items to be placed on top of the list...
Basically a more flexible element.
And by the way - I'm so happy about processwire and the way it works ?

  • Like 3

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
  • Recently Browsing   0 members

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