Mackski Posted October 3, 2016 Share Posted October 3, 2016 I have a field setup as a Page type. Custom selector to find selectable pages: template=user, roles=rider Users have the specified role, upon saving the page I get an error:Error saving field "rider_account" - Page 1029 is not valid for rider_account (Page 1029 does not match findPagesSelector: template=user, roles=rider) However, If I change the selector to: template=user it works (Although I get a full user list, not just those with role = rider) Strangely this works if I use "Custom PHP code": return $pages->find('template=user, roles=rider'); possible bug? Link to comment Share on other sites More sharing options...
adrian Posted October 3, 2016 Share Posted October 3, 2016 roles.name=rider Link to comment Share on other sites More sharing options...
Mackski Posted October 3, 2016 Author Share Posted October 3, 2016 Same error: Error saving field "rider_account" - Page 1029 is not valid for rider_account (Page 1029 does not match findPagesSelector: template=user, roles.name=rider) Link to comment Share on other sites More sharing options...
adrian Posted October 4, 2016 Share Posted October 4, 2016 5 hours ago, Mackski said: Same error: Error saving field "rider_account" - Page 1029 is not valid for rider_account (Page 1029 does not match findPagesSelector: template=user, roles.name=rider) I can confirm the same problem here although not sure why at the moment. As a quick fix, I discovered that it works if you use this: return $pages->find("template=user, roles=rider"); in the "Custom PHP code to find selectable pages" option instead. Can you please check that works for you? It would also be great if you'd consider posting an issue report about the custom selector option not working: https://github.com/processwire/processwire-issues Link to comment Share on other sites More sharing options...
Mackski Posted October 4, 2016 Author Share Posted October 4, 2016 I can confirm the workaround works. Issue logged. 1 Link to comment Share on other sites More sharing options...
Soma Posted October 4, 2016 Share Posted October 4, 2016 You have to use the role Id instead of the name. 1 Link to comment Share on other sites More sharing options...
adrian Posted October 4, 2016 Share Posted October 4, 2016 3 minutes ago, Soma said: You have to use the role Id instead of the name. Yeah, that does work but it does seem weird that the selector using the roles "name" populates the select options properly but just won't save. Link to comment Share on other sites More sharing options...
Mackski Posted October 4, 2016 Author Share Posted October 4, 2016 6 minutes ago, Soma said: You have to use the role Id instead of the name. Same error: Error saving field "rider_account" - Page 1029 is not valid for rider_account (Page 1029 does not match findPagesSelector: template=user, role.id=1015) Error saving field "rider_account" - Page 1029 is not valid for rider_account (Page 1029 does not match findPagesSelector: template=user, roles.id=1015) Link to comment Share on other sites More sharing options...
adrian Posted October 4, 2016 Share Posted October 4, 2016 just try: roles=1015 Link to comment Share on other sites More sharing options...
Soma Posted October 4, 2016 Share Posted October 4, 2016 Because it does a db search vs a in memory match thats why it doesn't validate. It's like this ever since. There was even several threads and git issues about this. 3 Link to comment Share on other sites More sharing options...
arjen Posted October 4, 2016 Share Posted October 4, 2016 I keep running into this too. More in depth info in this post by ryan. 4 Link to comment Share on other sites More sharing options...
Mackski Posted August 12, 2017 Author Share Posted August 12, 2017 I'm still having problems with customer selectors to find selectable pages. Specifically when trying to include unpublished pages, my custom selector is: template=horse_profile,include=all This selector only returns published pages, which is driving me nuts! 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