mindplay.dk Posted January 9, 2013 Share Posted January 9, 2013 I may have lost my mind, but I can't for the love of me find a way to create an InputfieldSelectMultiple - the module is installed, but when I go to create a new Field, I don't see an option to create such a field. I have tried every field I could think of, including Checkbox, Integer, Page, Text and TextArea, but "Input field type" either doesn't show at all, or doesn't show the "Select Multiple" option, except for Page, but that doesn't seem to be the right field-type. Looking inside "InputfieldSelect.module", I see things like "To keep a separate value and label, separate them with an equals sign. Example: value=My Option" - that's precisely what I want, but I can't seem to find any way select it... Help, please! Link to comment Share on other sites More sharing options...
Soma Posted January 9, 2013 Share Posted January 9, 2013 SelectMultiple is a input for page fields. Link to comment Share on other sites More sharing options...
mindplay.dk Posted January 9, 2013 Author Share Posted January 9, 2013 What is this then? public function ___getConfigInputfields() { $inputfields = parent::___getConfigInputfields(); // if dealing with an inputfield that has an associated fieldtype, // we don't need to perform the remaining configuration if($this->hasFieldtype !== false) return $inputfields; $isInputfieldSelect = $this->className() == 'InputfieldSelect'; $f = wire('modules')->get('InputfieldTextarea'); $f->attr('name', 'options'); $value = implode("\n", $this->options); if(empty($value)) { $value = "=\nOption 1\nOption 2\nOption 3"; if(!$isInputfieldSelect) $value = ltrim($value, '='); } $f->attr('rows', 10); $f->label = $this->_('Options'); $f->description = $this->_('Enter the options that may be selected, one per line.'); $f->notes = ($isInputfieldSelect ? $this->_('To precede your list with a blank option, enter just a equals sign "=" as the first option.') . "\n" : '') . $this->_('To make an option selected, precede it with a plus sign. Example: +My Option') . "\n" . $this->_('To keep a separate value and label, separate them with an equals sign. Example: value=My Option') . "\n" . ($isInputfieldSelect ? $this->_('To create an optgroup (option group) indent the options in the group with 3 or more spaces.') : ''); $inputfields->add($f); return $inputfields; } What would be the use of entering your own "options" if this works only for a page selector? Link to comment Share on other sites More sharing options...
WillyC Posted January 9, 2013 Share Posted January 9, 2013 [quotamos]What would be the use of entering your own "options" if this works only for a page selector?[/quotamos] not-relationals times like forms bilder or api or mabe a trap Link to comment Share on other sites More sharing options...
mindplay.dk Posted January 9, 2013 Author Share Posted January 9, 2013 And what would you do when you need a multi-select list with a fixed set of options? (in my case, I want to provide a list of checkboxes that add select classes from a pre-defined set of class-names, to the class-attribute on a div-element in the template.) Link to comment Share on other sites More sharing options...
apeisa Posted January 9, 2013 Share Posted January 9, 2013 You create those options as pages and use page field. Inputfields can be used outside of PW admin also, that is why there is methods to add options. Form Builder is a great example, but of course most of the modules do use them to build their UI. Link to comment Share on other sites More sharing options...
Soma Posted January 9, 2013 Share Posted January 9, 2013 What is this then? public function ___getConfigInputfields() { $inputfields = parent::___getConfigInputfields(); // if dealing with an inputfield that has an associated fieldtype, // we don't need to perform the remaining configuration if($this->hasFieldtype !== false) return $inputfields; $isInputfieldSelect = $this->className() == 'InputfieldSelect'; $f = wire('modules')->get('InputfieldTextarea'); $f->attr('name', 'options'); $value = implode("\n", $this->options); if(empty($value)) { $value = "=\nOption 1\nOption 2\nOption 3"; if(!$isInputfieldSelect) $value = ltrim($value, '='); } $f->attr('rows', 10); $f->label = $this->_('Options'); $f->description = $this->_('Enter the options that may be selected, one per line.'); $f->notes = ($isInputfieldSelect ? $this->_('To precede your list with a blank option, enter just a equals sign "=" as the first option.') . "\n" : '') . $this->_('To make an option selected, precede it with a plus sign. Example: +My Option') . "\n" . $this->_('To keep a separate value and label, separate them with an equals sign. Example: value=My Option') . "\n" . ($isInputfieldSelect ? $this->_('To create an optgroup (option group) indent the options in the group with 3 or more spaces.') : ''); $inputfields->add($f); return $inputfields; } What would be the use of entering your own "options" if this works only for a page selector? As the inline comment states and what willy and apeisa said. Or have a look at this http://processwire.com/talk/topic/201-fieldtype-select-aka-drop-down/ Speaking of it, this module isn't listed on modules.processwire.com. Hani can you might add it? Link to comment Share on other sites More sharing options...
mindplay.dk Posted January 10, 2013 Author Share Posted January 10, 2013 You create those options as pages and use page field. That would make sense if there was any information associated with them - but this approach would require you to create two templates, one for the value list, and one for the values, and neither template would have any fields. And then creating pages just for those values. It seems wrong. 1 Link to comment Share on other sites More sharing options...
WillyC Posted January 10, 2013 Share Posted January 10, 2013 bigger. must.u think kkno.w. it is right.you. will Link to comment Share on other sites More sharing options...
Pete Posted January 10, 2013 Share Posted January 10, 2013 A lot of us do this and have a Tools template with just the title field that are used to populate Page fields for selects, autocompletes and ASMselects etc. It's perfectly normal to do this in ProcessWire bit yes it does feel strange to begin with. One advantage is that using ASMseldct (or others) is that you cam tick the option to add more values on the fly when adding pages. Give it a try Link to comment Share on other sites More sharing options...
Joss Posted January 10, 2013 Share Posted January 10, 2013 Try this: http://wiki.processwire.com/index.php/Select_Field It isn't a complete article, but it should give enough info Link to comment Share on other sites More sharing options...
mindplay.dk Posted January 10, 2013 Author Share Posted January 10, 2013 After sleeping on it, I've decided to use Pages, as suggested. I'm going to create a template called Taxonomy - this template will allow children of it's own type. I will create one root Taxonomy page ("/taxonomy"), and each taxonomy-type will just be a Taxonomy page under it ("/taxonomy/article-type") - the individual classifications will be child-pages under those: "/taxonomy/article-type/sports", etc. After thinking about it, compared to the idea of having simple enumerations/sets as a Field-type, I like this idea better, as it can grow - it will have only a title-field, but who knows, maybe somebody will want a summary and/or body-field on those one day, so that category overview pages can be displayed. Or some other need I haven't foreseen. Another thing I like better about this, is the fact that Taxonomies can be trees, not just flat lists - again, I don't need that right now, but requirements can change, and this way I'm not locked in, or risk having to write more code to extend a Field-type to support that. Perhaps an article about building Taxonomies should go into the Wiki? I will try to take notes and draft something while I build this. This is definitely a case where it would be very easy to over-engineer the solution in ProcessWire - for example, I was thinking at first that I would need multiple templates for different Taxonomies - then I thought, I need two templates, one for the taxonomy-type, and one for the taxonomy-classifications. But the absolute simplest solution is to have just a single template, so that the whole taxonomy data-structure is homogeneous. It's another great example of how the ProcessWire data-model really excels - the more I use it, the more convinced I become that there really isn't much you can't do with this data-model, and plus, it scales very nicely, both in terms of performance and complexity 3 Link to comment Share on other sites More sharing options...
Soma Posted January 10, 2013 Share Posted January 10, 2013 Another thing is with this approach you get relations and not some hard coded values, so you can change things later without worry. You can use different inputfields for the page field, whatever suits better and you could even sort them. Also if you add Multilanguage to the mix you still get everything out of it even translated without any effort. You can use such tag pages to populate a select on the frontend etc. And it's always flexible on different levels. That's some of what makes PW really enjoyable for me. 2 Link to comment Share on other sites More sharing options...
apeisa Posted January 10, 2013 Share Posted January 10, 2013 That is how I usually have my tags organized. And having things this way came super helpful in one project: Client wanted to automate most of the content rotating on the frontpage and main sections. Rotation needed be based on time - some articles were about winter, some about christmas, some about summer, some about some holidays in between etc. They had already tagged all their articles (200+) with tags (about 20) and even the thought about choosing "active months" or "startdate - enddate" for each article felt taunting. What we did was to extend those tags to have "active months" selections. This needed only little additional logic, but was a breeze for client to setup (editing 20 tags instead of 200 pages). And if someone decides to move Christmas from December to July... well - we are ready for it! And no - I didn't have a clue about that kind of "autorotation" idea when I build the site. 3 Link to comment Share on other sites More sharing options...
ryan Posted January 10, 2013 Share Posted January 10, 2013 One other benefit is that those relation/taxonomy pages are often quite useful new pages in your site that you wouldn't have had otherwise. Take the skyscrapers site as an example. The original plan for the site was to just show skyscrapers. Architects were setup as a multi page reference field. The architect template just has nothing but a "title" field. But since all the architects are now pages, we just implement a template file for them and they now add a lot of value to the site as they are quite useful landing pages. Link to comment Share on other sites More sharing options...
mindplay.dk Posted January 10, 2013 Author Share Posted January 10, 2013 Thanks for sharing that, apeisa - really useful and reassuring. This kind of thing really should be in the Wiki too - I wonder if the Wiki should have a dedicated area with descriptions of how to build and customize such features? I wonder what such a section would be called. (the word "Recipes" comes to mind - or perhaps "Patterns", or "Information Patterns" if you want to get really technical.) It's really important to collect and encourage new users to learn how common features can be built without (or with very little) code - many new users are going to be coming from CMS where such things require a plug-in, and a lot of people are going to assume that's necessary. Most CMS have a tagging/taxonomy module, for example, and it's features are set in stone. This kind of information needs to be readily available (even promoted) to developers. Of course, you can learn from the forums, so perhaps that's all that's needed - the trouble is finding the solutions in all the talk and long threads. Perhaps this could be solved by having some way to tag posts, so that they appear on a list somewhere. Stack Overflow does something similar - where you can post a reply to question in the "community wiki", making your post editable by others... Thoughts? 1 Link to comment Share on other sites More sharing options...
ryan Posted January 10, 2013 Share Posted January 10, 2013 You are right, we could probably use a section on the Page fieldtype here (among others). And a "how to create categories" guide/tutorial makes a lot of sense. I think we had one in the forums at some point, but think it's buried somewhere. Personally I learn best from examples, so that's the way I tend to communicate too. The Blog profile is a great example of the Page fieldtype in use for both categories and tags. Though it only uses them as flat (not nested) categories. The skyscraper profile also demonstrates the Page fieldtype, though not necessarily in the category context. We definitely need more written content in this area. Link to comment Share on other sites More sharing options...
diogo Posted January 10, 2013 Share Posted January 10, 2013 It's another great example of how the ProcessWire data-model really excels - the more I use it, the more convinced I become that there really isn't much you can't do with this data-model, and plus, it scales very nicely, both in terms of performance and complexity @ryan, coming from mindplay this should be taken as a big compliment 2 Link to comment Share on other sites More sharing options...
mindplay.dk Posted January 11, 2013 Author Share Posted January 11, 2013 Haha, I am pretty picky, I'll grant you that! ;-) I really like video for demonstrating things like this. I haven't been able to find a good, free screen recorder though - anyone? Link to comment Share on other sites More sharing options...
Pete Posted January 11, 2013 Share Posted January 11, 2013 Jing is okay for free. Link to comment Share on other sites More sharing options...
DaveP Posted January 11, 2013 Share Posted January 11, 2013 VLC does screen recording. 1 Link to comment Share on other sites More sharing options...
Joss Posted January 11, 2013 Share Posted January 11, 2013 You are right, we could probably use a section on the Page fieldtype here (among others). And a "how to create categories" guide/tutorial makes a lot of sense. I am partway through that here: http://wiki.processwire.com/index.php/Page_Field And I am creating categories and tags for myself at the moment, so I will use that as an example spin-off page. 2 Link to comment Share on other sites More sharing options...
mindplay.dk Posted January 12, 2013 Author Share Posted January 12, 2013 Anyone used ezvid ? ... I'm afraid of download this - it looks suspiciously free, and by that, I mean loaded with ads. Could be packed with ad-ware - I'm always suspicious of free software with no apparent business plan. I wonder what Ryan used for his ProcessWire videos? Link to comment Share on other sites More sharing options...
Joss Posted January 12, 2013 Share Posted January 12, 2013 Is Camstudio still going? That used to work okay and was free There are a couple of wiki stubs about this now, if anyone feels like chipping in! http://wiki.processwire.com/index.php/Categories_and_Tags Link to comment Share on other sites More sharing options...
Soma Posted January 12, 2013 Share Posted January 12, 2013 I always use screenomatic online screen recording. It is free and you can directly upload to youtube or computer. http://www.screencast-o-matic.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now