ryan Posted August 30, 2019 Posted August 30, 2019 This latest version of ProcessWire on the dev branch adds a new Inputfield module called “Toggle” that is an alternative to the existing Checkbox Inputfield. It also adds a nicer way to make column width adjustments to your fields when editing a template. This post covers all the details with screenshots and a short video: https://processwire.com/blog/posts/pw-3.0.139/ 23
BitPoet Posted August 31, 2019 Posted August 31, 2019 ? for the width adjustment, this is a really nice feature that makes setting up new templates and changing them much more convenient! Funnily, I just implemented a toggle inputfield myself and thought, oh bummer, I could have saved myself the work! Turns out, you weren't talking about a sliding toggle like I am working on, and the core toggle field type is a nice addition for cases where the choices need to be more verbose than a simple yes/no and on/off. It'll come in handy for some of the forms I have in the queue. I will have to rename my module, though ? It'll be CSS only. I still need to add color and size options, and it'll hopefully hit the module repo at the end of next week. 9
tpr Posted August 31, 2019 Posted August 31, 2019 Worth mentioning this module here: https://modules.processwire.com/modules/template-field-widths/ GIF: https://user-images.githubusercontent.com/1538852/49207167-0cbef100-f419-11e8-965a-ca46b4f256d1.gif 10
adrian Posted September 4, 2019 Posted September 4, 2019 On 8/30/2019 at 11:46 PM, tpr said: Worth mentioning this module here: https://modules.processwire.com/modules/template-field-widths/ Yeah, I feel like the new core addition could show the layout of the fields like your Robin's does. I guess the issue could be with not having enough room to show the field label, name, type and width, but maybe there is a solution that would work. 1
tpr Posted September 4, 2019 Posted September 4, 2019 It's not my module but @Robin S's, just to make it clear :) 2
nabo Posted September 5, 2019 Posted September 5, 2019 I'm trying to understand what are the differences between toggle and select options (with radio input of course) ?
wbmnfktr Posted September 5, 2019 Posted September 5, 2019 Some details were written down here: https://processwire.com/blog/posts/pw-3.0.139/#new-toggle-field This is some kind of feature you have to use, need or want to fully understand this fieldtype. I actually love to have such a field - but haven't played with it yet unfortunately - as it will probably save me tons of time and make things easier in the future. I will use it for conditional settings in my templates - I guess. At least I needed this kind of possibility in the past and now it's here.
BitPoet Posted September 13, 2019 Posted September 13, 2019 On 8/31/2019 at 7:48 AM, BitPoet said: Funnily, I just implemented a toggle inputfield myself and thought, oh bummer, I could have saved myself the work! Turns out, you weren't talking about a sliding toggle like I am working on, and the core toggle field type is a nice addition for cases where the choices need to be more verbose than a simple yes/no and on/off. It'll come in handy for some of the forms I have in the queue. I will have to rename my module, though ? It'll be CSS only. I still need to add color and size options, and it'll hopefully hit the module repo at the end of next week. Unfortunately, I didn't have enough time to really brush up the module, but I have nontheless pushed it to GitHub and created a topic for my SlidingToggle Inputfield (and Fieldtype) in the modules section.
elabx Posted September 13, 2019 Posted September 13, 2019 On 8/31/2019 at 1:46 AM, tpr said: Worth mentioning this module here: https://modules.processwire.com/modules/template-field-widths/ WOW NICE! Life is what happens when you are editing template context values. 1
Nils Wiere Posted December 18, 2019 Posted December 18, 2019 Hi @ryan, the toggle addition sounds really nice. I just set it up with the "integer" option and I can echo the values 0 and 1 for every item in the array correctly. However, when accessing the toggle (named "toggle_katalog") inside a selector, such as $products = $productFolder->children("sort=title, toggle_katalog=1"); I get zero matches. But there are actually hundreds of items with a value of 1. Am I missing something? I'm using PW 3.0.147. Thanks and best Nils
Nils Wiere Posted December 18, 2019 Posted December 18, 2019 Addition: It turns out that pre-selection doesn't work here in combination with selectors. What I did: I chose a "Default Selected Option" and made the field required. When editing the page, the selected default option is highlighted correctly in the UI and I can echo the values in the frontend – but when using selectors, the value is not considered. If I change the value of the toggle when editing a page, hit save and change it again + save, it works with selectors. Is there an approach to make it work with pre-selection? That would be important in my case. 1
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