Jump to content

Multi-value fields


tsdtsdtsd
 Share

Recommended Posts

Hi,

I have two new fieldtypes in my mind:

1. Well... Array :)

Like the image fieldtype, it should contain multiple text values in one field. A traditional array.

2. Multi-Value Field

This field contains multiple other fields and acts like an array (see 1.).

You create this fieldtype and assign other fields to it, which will then be only visible in the new multi-value field. So it's a set or group of other fields. Combined with the array functionality you can have something like this:

foreach( $page->multiField as $item) {
  echo $item->id;
  echo $item->name;
  echo $item->image;
}

I know, you can do something similar with child pages. But if your page already has child pages you would end up in a mixture of real and structural child pages which can get really messy.

Link to comment
Share on other sites

For 1 you could just use a textarea and have each new array item on a new line, or separated by a comma, and then explode the array in the template to read it - so essentially a field that's acting like a CSV list.

For 2, I think what you're after is what's been discussed quite a lot here: http://processwire.com/talk/index.php/topic,53.0.html

It's also on the roadmap for version 2.4: http://processwire.com/about/roadmap/

Link to comment
Share on other sites

So it's my fault for not searching correctly ^^

Sorry and thanks

Don't worry about it. :) Soma was just saying that there's been a lot of demand for this particular feature and it's a good idea. Keep posting and don't worry too much about searching (the search engine isn't great either). If everyone searched for it rather than posting, we might assume there wasn't much demand for this feature. I'm glad to know about the demand for repeatable fields. This is a small community and I'd almost always rather have people post than not. If we start having to keep up with hundreds of messages a day, than that would be different. But for now, when in doubt, post. :) You've added some good points to this discussion, and there will be a lot of good reference material in the forums for when this feature is in production.

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...