Jump to content

error saving page fields


Mackski
 Share

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...