Jump to content

Select Option fieldtype resetting unique IDs


a-ok
 Share

Recommended Posts

I'm defining some options in the Select Option fieldtype as follows:

1=Kalundborg Red
1035=Education Teal
1036=Living Orange
1037=Good Life Blue
1038=Careers Cyan

However on saving the field it resets them to

1=Kalundborg Red
2=Education Teal
3=Living Orange
4=Good Life Blue
5=Careers Cyan

Any reason why I cannot specify the unique ID to use?

Link to comment
Share on other sites

According to the docs there should be no issue with it:

"While we recommend letting the Options Fieldtype assign unique ID numbers for you, you may optionally assign your own. To do this, specify 123=title when adding a new option, where 123 is the ID number you wish to assign and title is the title text for your option."

https://processwire.com/api/modules/select-options-fieldtype/#adding-new-options

Also in the fieldtype_options table of database, option_id is int(10), so your numbers should work. Maybe a bug?

  • Like 1
Link to comment
Share on other sites

I've just tried to assign custom integer values as @oma did, and I'm having the same issue.

5992ff7a4b0fd_ClipboardImage.jpg.c3182bc84fc33db1e7a7fedf21db36c5.jpg

Once I submit, PW tries to delete former options as well. This is probably the intended behavior.

5992ffb74b787_ClipboardImage(1).jpg.2f3cc8ba7711ea0e2b51391f85603c19.jpg

and once I confirm to delete those options, I get unique incremential ids for the new options

5993001f014b9_ClipboardImage(2).jpg.36f23ddb29d9e92ad35cf76750a458b4.jpg

Checking the database entries, it seems value field isn't filled at all, instead option id is returned

599301098892d_ClipboardImage(3).jpg.66d223de1368478c8288953a6444fccd.jpg

I'd say there's definitely a bug here.

  • Like 1
Link to comment
Share on other sites

17 minutes ago, szabesz said:

According to the docs there should be no issue with it:

"While we recommend letting the Options Fieldtype assign unique ID numbers for you, you may optionally assign your own. To do this, specify 123=title when adding a new option, where 123 is the ID number you wish to assign and title is the title text for your option."

https://processwire.com/api/modules/select-options-fieldtype/#adding-new-options

Also in the fieldtype_options table of database, option_id is int(10), so your numbers should work. Maybe a bug?

Thanks for the help. Yeah... bizarre. I've always used 1, 2, 3, 4 etc but this time I needed higher values. I managed to edit the DB values directly and seemed to work fine so perhaps a bug as you say.

Link to comment
Share on other sites

  • 9 months later...

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