Jump to content

Possible Page field bug?


thetuningspoon
 Share

Recommended Posts

I'm trying to create a page field which can select from any user on the site that is assigned the role "broker".

I've setup the field as a basic select input and am using a custom selector (template=user, roles=broker) to display only the broker users.

When I edit a page, the select drop down shows all of the correct users. However, if I try to select one and save the page I get the following error:

Session: Error saving field "broker" - Page 1031 is not valid for broker

Link to comment
Share on other sites

I can confirm the same problem. It works fine if the roles part of the selector is not included - all users are displayed and selection of one and saving the page works fine. Doesn't help you I know, but maybe helps to narrow down the problem :)


As a workaround for now, use this in the custom PHP code option instead:

return $pages->get("name=users")->children("roles=broker");

PS Do you feel like submitting an Issue on Github about this?

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

Having trawled through the various options:

  • use ID of roles
  • Custom PHP utilising ->hasRole
  • use path of role

I can display a list of users defined by a role (in the above ways), for a Page field, but no matter what I try I always get a failed save. Am I missing something? Have I misread the documentation and can't assign Pages under the admin section to pages in the non-admin section?

Any help would be appreciated as I'm completely stumped.

EDIT: Currently running 2.5.3

EDIT2: Soma's test script returns valid for all of the users using the above methods, invalid when using the role name (as expected).

EDIT 3:

On further testing it transpires that the only way I seem to be able to add user pages to the page field is via the "parent of selectable pages" setting. All other settings cause an error similar to Error saving field "assigned" - Page 41 is not valid for assigned whether used in conjunction or as a stand-alone.

Final Edit:

Resolved - issue caused by ambiguous description (see screenshot).

post-1687-0-57484900-1421941368_thumb.pn

It turns out that the selector alone is sufficient to display the correct pages, but without selecting the appropriate parent the pages would not add. Could I therefore propose (should this be the intended behaviour) that the description of the custom selector is updated to reflect this? The current wording of "rather than" implies that the selector option overrides the previous two and can be used standalone.

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...