Mackski Posted August 10, 2015 Share Posted August 10, 2015 I get this error when creating a page with related field selector: Error saving field "coach_user" - Page 1152 is not valid for coach_user (Page 1152 does not match findPagesSelector: template=user,roles=coach,include=all) Code: $user->addRole('coach'); $user->save(); // then $p = new Page(); $p->template = 'coach'; $p->coach_user = $user->id; $p->save(); The selector for the page field "coach_user" is: template=user,roles=coach Is this a bug or am I missing something simple? Link to comment Share on other sites More sharing options...
adrian Posted August 10, 2015 Share Posted August 10, 2015 What are the rules under Input > Selectable Pages for the "coach_user" page field? Do they allow adding users? Link to comment Share on other sites More sharing options...
Mackski Posted August 10, 2015 Author Share Posted August 10, 2015 Maybe I should clarify things. The obove selector does work in the backend when displaying the list of usernames in the select box, the problem occurs when trying to add users from the API or updating the selectbox in the backend. So how would I allow adding users? I have tried the option "Allow new pages to be created from this field" with no luck.It does work however if I only set "Selectable template" to users. Link to comment Share on other sites More sharing options...
Mackski Posted August 10, 2015 Author Share Posted August 10, 2015 Now I feel silly, it was a selector issue, this works: template=user,role*=coach 1 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