ryan Posted August 29, 2013 Author Share Posted August 29, 2013 Would this also work with fieldsets? That displaying a fieldsets is depended on a choice from lets say a checkbox or dropdown Yes, it does work with Fieldsets. The first version doesn't work with tabs (FieldsetTab) though. I guess the selector for that would be something like user.role=editor|manager as well as user.id=41 maybe for scenarios where the main admin user wants to test some stuff or have hidden fields that other superusers can't see (though that's silly as other superusers could give themselves access anyway - just thinking of odd scenarios!). I think this seems like a good idea Pete. I'll look into how best to implement in the next version. The first version I need to get committed to the dev source tomorrow (30th), so not planning to expand the scope of it this week, but moving forward, would like to continue expanding the dependencies system everywhere it makes sense. And your ideas here do seem like they could be very useful, and may not be very difficult to implement. Something to keep in mind is that dependencies are assumed to be things that can change during the course of filling out the form (i.e. if this field is populated, then this field is available, etc.). So when we get into things like user roles, we're talking about things that don't change during the course of the form. So these would be an entirely different kind of dependency. These would be dependencies that would be applicable before the form is actually rendered. They wouldn't need to be considered by the javascript dependencies at all. As a result, it really might make more sense for this capability to be something separate, at least from the code perspective. 6 Link to comment Share on other sites More sharing options...
pwired Posted August 29, 2013 Share Posted August 29, 2013 Wowza, with the rate processwire and the forum is developing lately I wonder how it will be in a years time Link to comment Share on other sites More sharing options...
apeisa Posted August 29, 2013 Share Posted August 29, 2013 Hmm yes, I hadn't thought of required fields (I was more thinking about field dependency in that if the user has a role then show that field) Doesn't we already have that in some regard at least: http://modules.processwire.com/modules/page-edit-field-permission/ Link to comment Share on other sites More sharing options...
kongondo Posted August 29, 2013 Share Posted August 29, 2013 Doesn't we already have that in some regard at least: http://modules.processwire.com/modules/page-edit-field-permission/ Ahem...this is what I said in my post above ; (#50) 1 Link to comment Share on other sites More sharing options...
apeisa Posted August 30, 2013 Share Posted August 30, 2013 Kongondo:totally missed that last time. Now I see your comment and agree, that is pretty much same comment 1 Link to comment Share on other sites More sharing options...
Pete Posted August 30, 2013 Share Posted August 30, 2013 Yeah, but I wanted to take it one step further and hide some of them based on roles. I had totally forgotten about that module though so thanks guys Link to comment Share on other sites More sharing options...
apeisa Posted August 30, 2013 Share Posted August 30, 2013 Haven't used yet, but I believe that module hides those fields already (there ain't no "disabled" mode for inputfields). Link to comment Share on other sites More sharing options...
ryan Posted August 30, 2013 Author Share Posted August 30, 2013 I've gone ahead and committed the Inputfield dependencies to the dev branch, for anyone that would like to help test. I've also posted a documentation page that explains how and where to use them, current limitations and examples. There are a near infinite number of potential scenarios on how these things could be used, so it's not possible for me to test everything locally. As a result, expect bugs and please report them when you find them. Thanks in advance for your help in testing. For non-default admin themes, some updates have to be made in order to support field dependencies. As a result, unless you are an admin theme developer, it's best to stick to the default admin theme when using field dependencies, temporarily. Field dependencies can also be used in FormBuilder. Though I've not done a lot of testing in FormBuilder yet, so don't recommend using field dependencies in front-end production forms just yet. Though in my initial testing, they seem to work just fine. Thanks again to Antti/Avoine for sponsoring field dependencies! 12 Link to comment Share on other sites More sharing options...
JeffS Posted August 30, 2013 Share Posted August 30, 2013 I go off to build stuff, come back and get floored with new PW stuff. Man it just keeps getting better! This will be super handy on some sites I have in the queue! Looking forward to 2.4! @Ryan Thanks for your hard work. A big shout out @Avoine and @Antti! 1 Link to comment Share on other sites More sharing options...
Soma Posted August 30, 2013 Share Posted August 30, 2013 oooooh weekend just started! I'm in!!! 3 Link to comment Share on other sites More sharing options...
kongondo Posted August 30, 2013 Share Posted August 30, 2013 Nice!!! Thx! btw..did you forget to bump dev version to 2.3.4? Still reads 2.3.3. in my install Link to comment Share on other sites More sharing options...
apeisa Posted August 30, 2013 Share Posted August 30, 2013 I had to neglect the existence of my family and start playing with this Ryan, dependencies seems to work great on templates. But I don't seem to get it working on Form Builder preview? Link to comment Share on other sites More sharing options...
ryan Posted August 30, 2013 Author Share Posted August 30, 2013 btw..did you forget to bump dev version to 2.3.4? Still reads 2.3.3. in my install Yep, I forgot. Just bumped it now, thanks. Ryan, dependencies seems to work great on templates. But I don't seem to get it working on Form Builder preview? I've done very little testing with FormBuilder so far. I've really been focused on getting everything stable with the page editor context, before focusing on FormBuilder context. However, what works in one InputfieldForm should work in another. I did just test in FormBuilder and it seems to be working here (testing with checkbox field). First thing to try is in your preview window, right click within it and select "reload" (and do it again just for good measure). We want to make sure it's not a result of an old cached version of inputfields.js or inputfields.css. The one used in the page editor specifies a version number, which prevents that one from being cached. Whereas FormBuilder does not, so there's a good chance that Chrome just doesn't see the changed files yet, especially given that it's in an iframe. If it's still not working, let me know the type of dependency you are doing (including the selector) or just export and email me the form JSON and I'll import here to test. Link to comment Share on other sites More sharing options...
apeisa Posted August 30, 2013 Share Posted August 30, 2013 Ah, it was the refresh! Didn't remember it had form embedded through iFrame, so my F5 refresh wasn't affecting that. Link to comment Share on other sites More sharing options...
Soma Posted August 30, 2013 Share Posted August 30, 2013 I just went ahead and tried to hide fieldset, and enter a checkboxfield=1 and after saving the fieldset_OPEN is invisible and the hirarchy is messed up. Link to comment Share on other sites More sharing options...
apeisa Posted August 30, 2013 Share Posted August 30, 2013 My fieldset behave perfect, hiding with selectfieldvalue=something. I really like that you can just say "required" for all the fields inside fieldset, and if the fieldset is hidden, then those fields inside that aren't required. Logical and powerful. 2 Link to comment Share on other sites More sharing options...
Soma Posted August 30, 2013 Share Posted August 30, 2013 The "fieldset1_END" is there but the OPEN is gone! Ah it's there's but loosing the indent... Link to comment Share on other sites More sharing options...
apeisa Posted August 30, 2013 Share Posted August 30, 2013 This is amazing stuff Ryan! Working very well, definitely even more robust than I even imagined! I love the implementation with data attributes too. Link to comment Share on other sites More sharing options...
Raymond Geerts Posted August 30, 2013 Share Posted August 30, 2013 Great work!, installing right now to do some testing Link to comment Share on other sites More sharing options...
ryan Posted August 31, 2013 Author Share Posted August 31, 2013 The "fieldset1_END" is there but the OPEN is gone! Ah it's there's but loosing the indent... That's a bug! Thanks for finding it. Just fixed in latest commit. While I was in there, I updated the fields list in the template editor to display more information (labels and types). This is amazing stuff Ryan! Working very well, definitely even more robust than I even imagined! I love the implementation with data attributes too. Thanks, glad that you are liking it so far! 3 Link to comment Share on other sites More sharing options...
Soma Posted August 31, 2013 Share Posted August 31, 2013 I was about to ask if its possible to add more info to the fields. Great addition thx ! 1 Link to comment Share on other sites More sharing options...
Soma Posted August 31, 2013 Share Posted August 31, 2013 When I use a showIf on with counter>0, counter<10 it doesn't work, it shows the field when the integer field is 1 and hides it again with a value of 2. I also tested my dimension fieldtype and it got the same behaviour when I only write "dimension_width>0" it gets hidden when the value is 2. Link to comment Share on other sites More sharing options...
ryan Posted September 1, 2013 Author Share Posted September 1, 2013 When I use a showIf on with counter>0, counter<10 it doesn't work, it shows the field when the integer field is 1 and hides it again with a value of 2. Thanks for the testing. I always seem to be thinking in PHP–looks like I needed to add some parseInt()'s in there (parseFloat()'s too). This should now be fixed in the latest commit. I also tested my dimension fieldtype and it got the same behaviour when I only write "dimension_width>0" it gets hidden when the value is 2. I'm curious to know if the dimension inputfield works with dependencies? I would think that it would not, given that there are multiple inputs and dependencies haven't been coded for multiple inputs on a single inputfield. But if it turns out to be working [after the last commit] that would be a nice surprise. Link to comment Share on other sites More sharing options...
Soma Posted September 1, 2013 Share Posted September 1, 2013 Thanks for the testing. I always seem to be thinking in PHP–looks like I needed to add some parseInt()'s in there (parseFloat()'s too). This should now be fixed in the latest commit. I'm curious to know if the dimension inputfield works with dependencies? I would think that it would not, given that there are multiple inputs and dependencies haven't been coded for multiple inputs on a single inputfield. But if it turns out to be working [after the last commit] that would be a nice surprise. Yes it does work, as the I use the input names and in dimensions inputfield I set them to "fieldname_width, fieldname_height", so this seems to work fine. 2 Link to comment Share on other sites More sharing options...
Raymond Geerts Posted September 2, 2013 Share Posted September 2, 2013 Did some testing of the beta version and noticed a few things. In my template i have a field (d_product) with type of page that holds the product pages, the selection is limited to 1 page. Testing to show a certain field (d_nr) when the d_product page id is 1008, 1009, 1010 or 1011 This does work: d_product>1007,d_product<1012 This does'nt work: d_product>=1008,d_product<=1011 This also does'nt work: d_product=1008,d_product=1009,d_product=1010,d_product=1011 This does'nt work for now as expected (described in current limitations): d_product=1008|1009|1010|1011 Optimal would be if it could do something like the following. I saw this is planned for a future release. d_product.d_type_select.name='regioblad' 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