Jump to content

Choosing between Page Reference and Options field types


Robin S
 Share

Recommended Posts

In a situation where you need some options for an inputfield and it's unlikely that any subfields will ever need to be added to those options, is there any reason to prefer a Page Reference field over an Options field or vice versa?

I'm not concerned about the setup time for either (probably Options is a little faster but there's not a lot in it) - just if one is perhaps more performant than the other or there is some catch with one of them that isn't obvious at first. I've always used Page Reference fields so far.

Link to comment
Share on other sites

I think there are good examples when page references are overkill, such as simple form options (list of countries, list of contact types in a simple contact form, etc...) As a rule of thumb I use this reasoning: am I absolutely sure I do NOT WANT more than simple options? If in doubt, I use page references just to make things extendable in the future.

  • Like 4
Link to comment
Share on other sites

3 hours ago, szabesz said:

As a rule of thumb I use this reasoning: am I absolutely sure I do NOT WANT more than simple options? If in doubt, I use page references just to make things extendable in the future.

+1

  • Like 2
Link to comment
Share on other sites

Thanks for the replies. I remembered a downside of the Options fieldtype and that is awkwardness of adding selectable options to the field via the API:

I think I will stick with Page Reference fields for the most part.

Link to comment
Share on other sites

i mainly use the options fieldtype for non relational type selects with huge numbers of options, such as countries, cities, states, and such where i just don't want those things showing up as pages..

  • Like 2
Link to comment
Share on other sites

27 minutes ago, Macrura said:

where i just don't want those things showing up as pages

Yeah, when I first started working with pages simply as options for a Page Reference field I thought that their presence in the page tree might be confusing for editors, but nobody has ever mentioned it so I don't worry about it now.

Another thing that probably works but that I haven't tried is storing such pages under the Admin branch of the tree. Does anyone do this and does it work okay?

Link to comment
Share on other sites

24 minutes ago, Robin S said:

Yeah, when I first started working with pages simply as options for a Page Reference field I thought that their presence in the page tree might be confusing for editors, but nobody has ever mentioned it so I don't worry about it now.

I normally store my page references in a section of the main website page tree.  I give this section a name that contains the word "Configuration ".

pw-page-reference.thumb.png.41c8794f404b48b76bdf0568b9aeba83.png

I also store the results of Page Tables in this section.

  • Like 4
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...